about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-07-06 20:47:06 -0700
committerJosh Triplett <josh@joshtriplett.org>2025-07-06 20:49:12 -0700
commitef0465a7eb49252265701454cec222575a425b77 (patch)
tree198dafd79ed6c9d62408a6c66cdb3a0348f91534
parent493cdf226922495b861c6fd6f0c4ddfcedaa99d9 (diff)
downloadrust-ef0465a7eb49252265701454cec222575a425b77.tar.gz
rust-ef0465a7eb49252265701454cec222575a425b77.zip
mbe: Clarify comments about error handling in `compile_declarative_macro`
-rw-r--r--compiler/rustc_expand/src/mbe/macro_rules.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs
index 26b37caac48..89547088f50 100644
--- a/compiler/rustc_expand/src/mbe/macro_rules.rs
+++ b/compiler/rustc_expand/src/mbe/macro_rules.rs
@@ -386,7 +386,8 @@ pub fn compile_declarative_macro(
     let body = macro_def.body.tokens.clone();
     let mut p = Parser::new(&sess.psess, body, rustc_parse::MACRO_ARGUMENTS);
 
-    // Don't abort iteration early, so that multiple errors can be reported.
+    // Don't abort iteration early, so that multiple errors can be reported. We only abort early on
+    // parse failures we can't recover from.
     let mut guar = None;
     let mut check_emission = |ret: Result<(), ErrorGuaranteed>| guar = guar.or(ret.err());
 
@@ -395,8 +396,6 @@ pub fn compile_declarative_macro(
     while p.token != token::Eof {
         let lhs_tt = p.parse_token_tree();
         let lhs_tt = parse_one_tt(lhs_tt, RulePart::Pattern, sess, node_id, features, edition);
-        // We don't handle errors here, the driver will abort after parsing/expansion. We can
-        // report every error in every macro this way.
         check_emission(check_lhs(sess, node_id, &lhs_tt));
         if let Err(e) = p.expect(exp!(FatArrow)) {
             return dummy_syn_ext(e.emit());