This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed
compiler/rustc_errors/src Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -1456,10 +1456,10 @@ impl DiagCtxtInner {
14561456 }
14571457
14581458 if diagnostic. has_future_breakage ( ) {
1459- // Future breakages aren't emitted if they're `Level::Allow`,
1460- // but they still need to be constructed and stashed below,
1461- // so they'll trigger the must_produce_diag check.
1462- assert ! ( matches!( diagnostic. level, Error | Warning | Allow ) ) ;
1459+ // Future breakages aren't emitted if they're `Level::Allow` or
1460+ // `Level::Expect`, but they still need to be constructed and
1461+ // stashed below, so they'll trigger the must_produce_diag check.
1462+ assert ! ( matches!( diagnostic. level, Error | Warning | Allow | Expect ( _ ) ) ) ;
14631463 self . future_breakage_diagnostics . push ( diagnostic. clone ( ) ) ;
14641464 }
14651465
Original file line number Diff line number Diff line change 1+ // This test covers similar crashes from both #126521 and #126751.
2+
13macro_rules! foo {
24 ( $val: ident) => {
35 true ;
46 } ;
57}
68
9+ macro_rules! bar {
10+ ( $val: ident) => {
11+ ( 5_i32 . overflowing_sub( 3 ) ) ;
12+ } ;
13+ }
14+
715fn main ( ) {
816 #[ expect( semicolon_in_expressions_from_macros) ]
917 //~^ ERROR the `#[expect]` attribute is an experimental feature
1018 let _ = foo ! ( x) ;
19+
20+ #[ expect( semicolon_in_expressions_from_macros) ]
21+ //~^ ERROR the `#[expect]` attribute is an experimental feature
22+ let _ = bar ! ( x) ;
1123}
Original file line number Diff line number Diff line change 11error[E0658]: the `#[expect]` attribute is an experimental feature
2- --> $DIR/expect-future_breakage-crash-issue-126521.rs:8 :5
2+ --> $DIR/expect-future_breakage-crash-issue-126521.rs:16 :5
33 |
44LL | #[expect(semicolon_in_expressions_from_macros)]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,6 +8,16 @@ LL | #[expect(semicolon_in_expressions_from_macros)]
88 = help: add `#![feature(lint_reasons)]` to the crate attributes to enable
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
11- error: aborting due to 1 previous error
11+ error[E0658]: the `#[expect]` attribute is an experimental feature
12+ --> $DIR/expect-future_breakage-crash-issue-126521.rs:20:5
13+ |
14+ LL | #[expect(semicolon_in_expressions_from_macros)]
15+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+ |
17+ = note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
18+ = help: add `#![feature(lint_reasons)]` to the crate attributes to enable
19+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
21+ error: aborting due to 2 previous errors
1222
1323For more information about this error, try `rustc --explain E0658`.
You can’t perform that action at this time.
0 commit comments