Skip to content

Commit

Permalink
Undo debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
theo-lw committed Sep 1, 2021
1 parent ce9e765 commit bc9877c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
12 changes: 1 addition & 11 deletions compiler/rustc_parse/src/parser/expr.rs
Expand Up @@ -23,8 +23,6 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{BytePos, Pos};
use std::mem;

use tracing::debug;

/// Possibly accepts an `token::Interpolated` expression (a pre-parsed expression
/// dropped into the token stream, which happens while parsing the result of
/// macro expansion). Placement of these is not as complex as I feared it would
Expand Down Expand Up @@ -165,24 +163,18 @@ impl<'a> Parser<'a> {
if [token::DotDot, token::DotDotDot, token::DotDotEq].contains(&self.token.kind) {
return self.parse_prefix_range_expr(attrs);
} else {
let result = self.parse_prefix_expr(attrs);
debug!("parse_prefix_expr result: {:?}", &result);
result?
self.parse_prefix_expr(attrs)?
}
};
debug!("parse_assoc_expr_with(lhs = {:?})", &lhs);
let last_type_ascription_set = self.last_type_ascription.is_some();

if !self.should_continue_as_assoc_expr(&lhs) {
self.last_type_ascription = None;
return Ok(lhs);
}

debug!("continue_as_assoc_expr");

self.expected_tokens.push(TokenType::Operator);
while let Some(op) = self.check_assoc_op() {
debug!("op: {:?}", op);
// Adjust the span for interpolated LHS to point to the `$lhs` token
// and not to what it refers to.
let lhs_span = match self.prev_token.kind {
Expand Down Expand Up @@ -363,7 +355,6 @@ impl<'a> Parser<'a> {
/// but the next token implies this should be parsed as an expression.
/// For example: `if let Some(x) = x { x } else { 0 } / 2`.
fn error_found_expr_would_be_stmt(&self, lhs: &Expr) {
debug!("error_found_expr_would_be_stmt(lhs: {:?})", lhs);
let mut err = self.struct_span_err(
self.token.span,
&format!("expected expression, found `{}`", pprust::token_to_string(&self.token),),
Expand Down Expand Up @@ -526,7 +517,6 @@ impl<'a> Parser<'a> {
make_it!(this, attrs, |this, _| this.parse_borrow_expr(lo))
}
token::BinOp(token::Plus) => {
debug!("leading + detected: {:?}", lo);
let mut err = this.struct_span_err(lo, "leading `+` is not supported");
err.span_label(lo, "unexpected `+`");

Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_parse/src/parser/stmt.rs
Expand Up @@ -21,8 +21,6 @@ use rustc_span::symbol::{kw, sym};

use std::mem;

use tracing::debug;

impl<'a> Parser<'a> {
/// Parses a statement. This stops just before trailing semicolons on everything but items.
/// e.g., a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed.
Expand Down Expand Up @@ -420,7 +418,6 @@ impl<'a> Parser<'a> {
if self.token == token::Eof {
break;
}
debug!("parsing statements, stmts: {:?}", &stmts);
let stmt = match self.parse_full_stmt(recover) {
Err(mut err) if recover.yes() => {
self.maybe_annotate_with_ascription(&mut err, false);
Expand Down

0 comments on commit bc9877c

Please sign in to comment.