File tree 3 files changed +28
-6
lines changed
compiler/rustc_errors/src
3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -1456,10 +1456,10 @@ impl DiagCtxtInner {
1456
1456
}
1457
1457
1458
1458
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 ( _ ) ) ) ;
1463
1463
self . future_breakage_diagnostics . push ( diagnostic. clone ( ) ) ;
1464
1464
}
1465
1465
Original file line number Diff line number Diff line change
1
+ // This test covers similar crashes from both #126521 and #126751.
2
+
1
3
macro_rules! foo {
2
4
( $val: ident) => {
3
5
true ;
4
6
} ;
5
7
}
6
8
9
+ macro_rules! bar {
10
+ ( $val: ident) => {
11
+ ( 5_i32 . overflowing_sub( 3 ) ) ;
12
+ } ;
13
+ }
14
+
7
15
fn main ( ) {
8
16
#[ expect( semicolon_in_expressions_from_macros) ]
9
17
//~^ ERROR the `#[expect]` attribute is an experimental feature
10
18
let _ = foo ! ( x) ;
19
+
20
+ #[ expect( semicolon_in_expressions_from_macros) ]
21
+ //~^ ERROR the `#[expect]` attribute is an experimental feature
22
+ let _ = bar ! ( x) ;
11
23
}
Original file line number Diff line number Diff line change 1
1
error[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
3
3
|
4
4
LL | #[expect(semicolon_in_expressions_from_macros)]
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,6 +8,16 @@ LL | #[expect(semicolon_in_expressions_from_macros)]
8
8
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable
9
9
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10
10
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
12
22
13
23
For more information about this error, try `rustc --explain E0658`.
You can’t perform that action at this time.
0 commit comments