Skip to content

Commit 2e29575

Browse files
committed
[EXPERIMENT] Panic when the pretty-print/reparse check fails
Opening for a Crater run. Most of the failures will probably be due to minor pretty-printer inconsistencies, but we might find some token collection bugs.
1 parent 3984ca2 commit 2e29575

File tree

1 file changed

+3
-1
lines changed
  • compiler/rustc_parse/src

1 file changed

+3
-1
lines changed

compiler/rustc_parse/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,10 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
378378

379379
info!("cached tokens debug: {:?}", tokens);
380380
info!("reparsed tokens debug: {:?}", reparsed_tokens_with_parens);
381+
panic!("Mismatched tokens at {:?} : tokens: {:?}", span, tokens);
382+
} else {
383+
panic!("Missing tokens at {:?} : reparsed tokens: {:?}", span, reparsed_tokens);
381384
}
382-
reparsed_tokens
383385
}
384386

385387
// See comments in `Nonterminal::to_tokenstream` for why we care about

0 commit comments

Comments
 (0)