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 {
5
5
assert_eq!("A", "A");
6
6
//~^ WARN trailing semicolon in macro
7
7
//~| WARN this was previously
8
+ //~| NOTE macro invocations at the end of a block
9
+ //~| NOTE to ignore the value produced by the macro
8
10
//~| NOTE for more information
9
11
//~| NOTE `#[warn(semicolon_in_expressions_from_macros)]` on by default
10
12
assert_eq!("B", "B");
@@ -20,4 +22,6 @@ fn main() {
20
22
//~| NOTE in this expansion
21
23
//~| NOTE in this expansion
22
24
//~| NOTE in this expansion
25
+ //~| NOTE in this expansion
26
+ //~| NOTE in this expansion
23
27
}
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ macro_rules! foo {
5
5
assert_eq!( "A" , "A" ) ;
6
6
//~^ WARN trailing semicolon in macro
7
7
//~| WARN this was previously
8
+ //~| NOTE macro invocations at the end of a block
9
+ //~| NOTE to ignore the value produced by the macro
8
10
//~| NOTE for more information
9
11
//~| NOTE `#[warn(semicolon_in_expressions_from_macros)]` on by default
10
12
assert_eq!( "B" , "B" ) ;
@@ -20,4 +22,6 @@ fn main() {
20
22
//~| NOTE in this expansion
21
23
//~| NOTE in this expansion
22
24
//~| NOTE in this expansion
25
+ //~| NOTE in this expansion
26
+ //~| NOTE in this expansion
23
27
}
Original file line number Diff line number Diff line change 1
1
error: 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
3
3
|
4
4
LL | assert_eq!("B", "B");
5
5
| ^^^^^^^^^
@@ -23,6 +23,8 @@ LL | foo!()
23
23
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
24
24
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
25
25
= 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`
26
28
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
27
29
28
30
error: aborting due to previous error; 1 warning emitted
You can’t perform that action at this time.
0 commit comments