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 +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ macro_rules! foo {
55 assert_eq!("A", "A");
66 //~^ WARN trailing semicolon in macro
77 //~| WARN this was previously
8+ //~| NOTE macro invocations at the end of a block
9+ //~| NOTE to ignore the value produced by the macro
810 //~| NOTE for more information
911 //~| NOTE `#[warn(semicolon_in_expressions_from_macros)]` on by default
1012 assert_eq!("B", "B");
@@ -20,4 +22,6 @@ fn main() {
2022 //~| NOTE in this expansion
2123 //~| NOTE in this expansion
2224 //~| NOTE in this expansion
25+ //~| NOTE in this expansion
26+ //~| NOTE in this expansion
2327}
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ macro_rules! foo {
55 assert_eq!( "A" , "A" ) ;
66 //~^ WARN trailing semicolon in macro
77 //~| WARN this was previously
8+ //~| NOTE macro invocations at the end of a block
9+ //~| NOTE to ignore the value produced by the macro
810 //~| NOTE for more information
911 //~| NOTE `#[warn(semicolon_in_expressions_from_macros)]` on by default
1012 assert_eq!( "B" , "B" ) ;
@@ -20,4 +22,6 @@ fn main() {
2022 //~| NOTE in this expansion
2123 //~| NOTE in this expansion
2224 //~| NOTE in this expansion
25+ //~| NOTE in this expansion
26+ //~| NOTE in this expansion
2327}
Original file line number Diff line number Diff line change 11error: macro expansion ignores token `assert_eq` and any following
2- --> $DIR/macro-in-expression-context.rs:10 :9
2+ --> $DIR/macro-in-expression-context.rs:12 :9
33 |
44LL | assert_eq!("B", "B");
55 | ^^^^^^^^^
@@ -23,6 +23,8 @@ LL | foo!()
2323 = note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
2424 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2525 = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
26+ = note: macro invocations at the end of a block are treated as expressions
27+ = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
2628 = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
2729
2830error: aborting due to previous error; 1 warning emitted
You can’t perform that action at this time.
0 commit comments