Skip to content

Commit ef0465a

Browse files
committed
mbe: Clarify comments about error handling in compile_declarative_macro
1 parent 493cdf2 commit ef0465a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ pub fn compile_declarative_macro(
386386
let body = macro_def.body.tokens.clone();
387387
let mut p = Parser::new(&sess.psess, body, rustc_parse::MACRO_ARGUMENTS);
388388

389-
// Don't abort iteration early, so that multiple errors can be reported.
389+
// Don't abort iteration early, so that multiple errors can be reported. We only abort early on
390+
// parse failures we can't recover from.
390391
let mut guar = None;
391392
let mut check_emission = |ret: Result<(), ErrorGuaranteed>| guar = guar.or(ret.err());
392393

@@ -395,8 +396,6 @@ pub fn compile_declarative_macro(
395396
while p.token != token::Eof {
396397
let lhs_tt = p.parse_token_tree();
397398
let lhs_tt = parse_one_tt(lhs_tt, RulePart::Pattern, sess, node_id, features, edition);
398-
// We don't handle errors here, the driver will abort after parsing/expansion. We can
399-
// report every error in every macro this way.
400399
check_emission(check_lhs(sess, node_id, &lhs_tt));
401400
if let Err(e) = p.expect(exp!(FatArrow)) {
402401
return dummy_syn_ext(e.emit());

0 commit comments

Comments
 (0)