clean up debug code

This commit is contained in:
yukang 2023-03-14 23:48:33 +08:00
parent 10512b2932
commit 1b08eaca20
5 changed files with 5 additions and 21 deletions

View File

@ -1775,21 +1775,13 @@ impl<'a> Parser<'a> {
lo: Span, lo: Span,
result: PResult<'a, P<Expr>>, result: PResult<'a, P<Expr>>,
) -> P<Expr> { ) -> P<Expr> {
use crate::parser::DUMMY_NODE_ID;
match result { match result {
Ok(x) => x, Ok(x) => x,
Err(mut err) => { Err(mut err) => {
err.emit(); err.emit();
// Recover from parse error, callers expect the closing delim to be consumed. // Recover from parse error, callers expect the closing delim to be consumed.
self.consume_block(delim, ConsumeClosingDelim::Yes); self.consume_block(delim, ConsumeClosingDelim::Yes);
debug!("recover_seq_parse_error: consumed tokens until {:?} {:?}", lo, self.token); self.mk_expr(lo.to(self.prev_token.span), ExprKind::Err)
let res = self.mk_expr(lo.to(self.prev_token.span), ExprKind::Err);
if res.id == DUMMY_NODE_ID {
//panic!("debug now ....: {:?}", res);
res
} else {
res
}
} }
} }
} }
@ -1871,7 +1863,6 @@ impl<'a> Parser<'a> {
&& brace_depth == 0 && brace_depth == 0
&& bracket_depth == 0 => && bracket_depth == 0 =>
{ {
debug!("recover_stmt_ return - Comma");
break; break;
} }
_ => self.bump(), _ => self.bump(),

View File

@ -202,9 +202,6 @@ impl<'a> Parser<'a> {
segments.push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt))); segments.push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt)));
} }
self.parse_path_segments(&mut segments, style, ty_generics)?; self.parse_path_segments(&mut segments, style, ty_generics)?;
if segments.len() > 1 {
//panic!("debug now ...");
}
Ok(Path { segments, span: lo.to(self.prev_token.span), tokens: None }) Ok(Path { segments, span: lo.to(self.prev_token.span), tokens: None })
} }
@ -740,7 +737,6 @@ impl<'a> Parser<'a> {
&mut self, &mut self,
ty_generics: Option<&Generics>, ty_generics: Option<&Generics>,
) -> PResult<'a, Option<GenericArg>> { ) -> PResult<'a, Option<GenericArg>> {
debug!("pain");
let start = self.token.span; let start = self.token.span;
let arg = if self.check_lifetime() && self.look_ahead(1, |t| !t.is_like_plus()) { let arg = if self.check_lifetime() && self.look_ahead(1, |t| !t.is_like_plus()) {
// Parse lifetime argument. // Parse lifetime argument.
@ -749,7 +745,6 @@ impl<'a> Parser<'a> {
// Parse const argument. // Parse const argument.
GenericArg::Const(self.parse_const_arg()?) GenericArg::Const(self.parse_const_arg()?)
} else if self.check_type() { } else if self.check_type() {
debug!("type");
// Parse type argument. // Parse type argument.
// Proactively create a parser snapshot enabling us to rewind and try to reparse the // Proactively create a parser snapshot enabling us to rewind and try to reparse the

View File

@ -777,10 +777,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
.sess .sess
.create_err(errs::SelfImportOnlyInImportListWithNonEmptyPrefix { span }), .create_err(errs::SelfImportOnlyInImportListWithNonEmptyPrefix { span }),
ResolutionError::FailedToResolve { label, suggestion } => { ResolutionError::FailedToResolve { label, suggestion } => {
if label.len() > 0 {
//panic!("debug now");
}
let mut err = let mut err =
struct_span_err!(self.tcx.sess, span, E0433, "failed to resolve: {}", &label); struct_span_err!(self.tcx.sess, span, E0433, "failed to resolve: {}", &label);
err.span_label(span, label); err.span_label(span, label);

View File

@ -3715,7 +3715,6 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
} }
/// Handles paths that may refer to associated items. /// Handles paths that may refer to associated items.
#[instrument(level = "debug", skip(self))]
fn resolve_qpath( fn resolve_qpath(
&mut self, &mut self,
qself: &Option<P<QSelf>>, qself: &Option<P<QSelf>>,
@ -3723,6 +3722,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
ns: Namespace, ns: Namespace,
finalize: Finalize, finalize: Finalize,
) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>> { ) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>> {
debug!(
"resolve_qpath(qself={:?}, path={:?}, ns={:?}, finalize={:?})",
qself, path, ns, finalize,
);
if let Some(qself) = qself { if let Some(qself) = qself {
if qself.position == 0 { if qself.position == 0 {
// This is a case like `<T>::B`, where there is no // This is a case like `<T>::B`, where there is no

View File

@ -305,7 +305,6 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
/// Handles error reporting for `smart_resolve_path_fragment` function. /// Handles error reporting for `smart_resolve_path_fragment` function.
/// Creates base error and amends it with one short label and possibly some longer helps/notes. /// Creates base error and amends it with one short label and possibly some longer helps/notes.
#[instrument(level = "debug", skip(self))]
pub(crate) fn smart_resolve_report_errors( pub(crate) fn smart_resolve_report_errors(
&mut self, &mut self,
path: &[Segment], path: &[Segment],