Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit cbc5e38

Browse files
committed
Don't drop a DiagnosticBuilder (rust-lang#5413)
1 parent c4416f2 commit cbc5e38

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/parse/macros/cfg_if.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ fn parse_cfg_if_inner<'a>(
4444
// See also https://github.com/rust-lang/rust/pull/79433
4545
parser
4646
.parse_attribute(rustc_parse::parser::attr::InnerAttrPolicy::Permitted)
47-
.map_err(|_| "Failed to parse attributes")?;
47+
.map_err(|err| {
48+
err.cancel();
49+
parser.sess.span_diagnostic.reset_err_count();
50+
"Failed to parse attributes"
51+
})?;
4852
}
4953

5054
if !parser.eat(&TokenKind::OpenDelim(Delimiter::Brace)) {

0 commit comments

Comments
 (0)