Skip to content

Commit 8d13b2a

Browse files
committed
Store ErrorGuaranteed in ErrorReported
1 parent c0a7612 commit 8d13b2a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

compiler/rustc_expand/src/mbe/macro_parser.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
7373
pub(crate) use NamedMatch::*;
7474
pub(crate) use ParseResult::*;
75+
use rustc_errors::ErrorGuaranteed;
7576

7677
use crate::mbe::{KleeneOp, TokenTree};
7778

@@ -270,7 +271,7 @@ pub(crate) enum ParseResult<T> {
270271
Failure(Token, &'static str),
271272
/// Fatal error (malformed macro?). Abort compilation.
272273
Error(rustc_span::Span, String),
273-
ErrorReported,
274+
ErrorReported(ErrorGuaranteed),
274275
}
275276

276277
/// A `ParseResult` where the `Success` variant contains a mapping of
@@ -612,14 +613,14 @@ impl TtParser {
612613
// edition-specific matching behavior for non-terminals.
613614
let nt = match parser.to_mut().parse_nonterminal(kind) {
614615
Err(mut err) => {
615-
err.span_label(
616+
let guarantee = err.span_label(
616617
span,
617618
format!(
618619
"while parsing argument for this `{kind}` macro fragment"
619620
),
620621
)
621622
.emit();
622-
return ErrorReported;
623+
return ErrorReported(guarantee);
623624
}
624625
Ok(nt) => nt,
625626
};

compiler/rustc_expand/src/mbe/macro_rules.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ fn expand_macro<'cx>(
333333
cx.struct_span_err(span, &msg).emit();
334334
return DummyResult::any(span);
335335
}
336-
ErrorReported => return DummyResult::any(sp),
336+
ErrorReported(_) => return DummyResult::any(sp),
337337
}
338338

339339
// The matcher was not `Success(..)`ful.
@@ -470,7 +470,7 @@ pub fn compile_declarative_macro(
470470
.emit();
471471
return dummy_syn_ext();
472472
}
473-
ErrorReported => {
473+
ErrorReported(_) => {
474474
return dummy_syn_ext();
475475
}
476476
};

0 commit comments

Comments
 (0)