Skip to content

[crater] make SEMICOLON_IN_EXPRESSIONS_FROM_MACROS a hard error - #162768

Draft
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:semicolons-in-expressions
Draft

RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:semicolons-in-expressions

Conversation

@RalfJung

Copy link
Copy Markdown
Member

Crater experiment, see Zulip for context.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 14, 2026
@RalfJung

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 14, 2026
[crater] make SEMICOLON_IN_EXPRESSIONS_FROM_MACROS a hard error
@rust-bors

rust-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c92d9dd (c92d9dd0ee795cc0dcd31ea2dddf20fc01db2e4d)
Base parent: ed77b7b (ed77b7b8699e342c2dc842c83cb5fe4025252ee8)

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/lint/expect-future_breakage-crash-issue-126521.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lint/expect-future_breakage-crash-issue-126521.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/expect-future_breakage-crash-issue-126521" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/expect-future_breakage-crash-issue-126521.rs:7:13
   |
LL |         true;
   |             ^
...
LL |     let _ = foo!(x);
   |             ------- in this macro invocation
   |
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/expect-future_breakage-crash-issue-126521.rs:13:35
   |
LL |         (5_i32.overflowing_sub(3));
   |                                   ^
...
LL |     let _ = bar!(x);
   |             ------- in this macro invocation
   |
   = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)

error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/expect-future_breakage-crash-issue-126521.rs:7:13
   |
LL |         true;
   |             ^
...
LL |     let _ = foo!(x);
   |             ------- in this macro invocation
   |
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/expect-future_breakage-crash-issue-126521.rs:13:35
   |
LL |         (5_i32.overflowing_sub(3));
   |                                   ^
...
LL |     let _ = bar!(x);
   |             ------- in this macro invocation
   |
   = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 4 previous errors
------------------------------------------

---- [ui] tests/ui/lint/expect-future_breakage-crash-issue-126521.rs stdout end ----
---- [ui] tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018"
stdout: none
--- stderr -------------------------------
error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs:9:13
   |
---
   |
LL |         true; //~  WARN trailing semicolon in macro
   |             ^
...
LL |         let _ = foo!(third);
   |                 ----------- in this macro invocation
   |
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs:9:13
   |
LL |         true; //~  WARN trailing semicolon in macro
   |             ^
...
LL |         let _ = foo!(fourth);
   |                 ------------ in this macro invocation
   |
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: trailing semicolon in macro used in expression position
---
   |
LL |         true; //~  WARN trailing semicolon in macro
   |             ^
...
LL |     let _ = foo!(warn_in_expr);
   |             ------------------ in this macro invocation
   |
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs:9:13
   |
LL |         true; //~  WARN trailing semicolon in macro
   |             ^
...
LL |     let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work);
   |                                                            ------------------------- in this macro invocation
   |
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused attribute `allow`
##[warning]  --> /checkout/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs:50:13
   |
LL |     let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: the built-in attribute `allow` will be ignored, since it's applied to the macro invocation `foo`
  --> /checkout/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs:50:60
   |
LL |     let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work);
   |                                                            ^^^
   = note: requested on the command line with `-W unused-attributes`

error: aborting due to 7 previous errors; 1 warning emitted
------------------------------------------
---
8    |              ------ in this macro invocation
9    |
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
-    = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default
13    = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
14 
15 error: aborting due to 1 previous error

- 
- Future incompatibility report: Future breakage diagnostic:
---
-    |              ------ in this macro invocation
-    |
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
-    = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default
-    = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
31 
32 


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.rs:5:13
   |
---
To only update this specific test, also pass `--test-args lint/semicolon-in-expressions-from-macros/foreign-crate.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lint/semicolon-in-expressions-from-macros/foreign-crate.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/semicolon-in-expressions-from-macros/foreign-crate" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/semicolon-in-expressions-from-macros/foreign-crate/auxiliary"
stdout: none
--- stderr -------------------------------
error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/lint/semicolon-in-expressions-from-macros/foreign-crate.rs:8:13
   |
---
---- [ui] tests/ui/macros/issue-84195-lint-anon-const.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/macros/issue-84195-lint-anon-const/issue-84195-lint-anon-const.stderr`
diff of stderr:

7 LL |     let val: [u8; len!()] = [];
8    |                   ------ in this macro invocation
9    |
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
- note: the lint level is defined here
---
-    |
- LL |     () => { 0; };
-    |              ^
- ...
- LL |     let val: [u8; len!()] = [];
-    |                   ------ in this macro invocation
-    |
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
- note: the lint level is defined here
---
To only update this specific test, also pass `--test-args macros/issue-84195-lint-anon-const.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/macros/issue-84195-lint-anon-const.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/macros/issue-84195-lint-anon-const" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/macros/issue-84195-lint-anon-const.rs:8:14
   |
LL |     () => { 0; }; //~  ERROR trailing semicolon
   |              ^
...
LL |     let val: [u8; len!()] = [];
   |                   ------ in this macro invocation
   |
   = note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 1 previous error
---
10    = note: macro invocations at the end of a block are treated as expressions
11    = note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it`
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
-    = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default
15    = note: this error originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info)
16 
17 error: aborting due to 1 previous error

- 
- Future incompatibility report: Future breakage diagnostic:
---
-    = note: macro invocations at the end of a block are treated as expressions
-    = note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it`
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
-    = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default
-    = note: this error originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info)
35 
36 


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args macros/lint-trailing-macro-call.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/macros/lint-trailing-macro-call.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/macros/lint-trailing-macro-call" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/macros/lint-trailing-macro-call.rs:7:25
   |
LL |         #[cfg(false)] 25; //~  ERROR trailing semicolon in macro
   |                         ^
...
LL |     expand_it!()
   |     ------------ in this macro invocation
   |
---
11 
+ error: trailing semicolon in macro used in expression position
+   --> $DIR/macro-context.rs:3:15
+    |
+ LL |     () => ( i ; typeof );
+    |               ^
+ ...
+ LL |     let i = m!();
+    |             ---- in this macro invocation
+    |
---
70 
- error: trailing semicolon in macro used in expression position
-   --> $DIR/macro-context.rs:3:15
-    |
- LL |     () => ( i ; typeof );
-    |               ^
- ...
- LL |     let i = m!();
-    |             ---- in this macro invocation
-    |
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
-    = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default
-    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
- 
85 error: aborting due to 7 previous errors
86 
87 For more information about this error, try `rustc --explain E0425`.

- Future incompatibility report: Future breakage diagnostic:
- error: trailing semicolon in macro used in expression position
-   --> $DIR/macro-context.rs:3:15
-    |
- LL |     () => ( i ; typeof );
-    |               ^
- ...
- LL |     let i = m!();
-    |             ---- in this macro invocation
-    |
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
-    = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default
-    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
- 
103 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/macros/macro-context.rs:3:15
- LL |     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
+ error: trailing semicolon in macro used in expression position
+   --> $DIR/macro-context.rs:3:15
+    |
+ LL |     () => ( i ; typeof );
+    |               ^
+ ...
+ LL |     let i = m!();
+    |             ---- in this macro invocation
+    |
---
To only update this specific test, also pass `--test-args macros/macro-context.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/macros/macro-context.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/macros/macro-context" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: macro expansion ignores `;` and any tokens following
##[error]  --> /checkout/tests/ui/macros/macro-context.rs:3:15
   |
LL |     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
   |               ^
...
LL |     let a: m!();
   |            ---- caused by the macro expansion here
   |
   = note: the usage of `m!` is likely invalid in type context

error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/macros/macro-context.rs:3:15
   |
LL |     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
   |               ^
...
LL |     let i = m!();
   |             ---- in this macro invocation
   |
   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)

error: macro expansion ignores reserved keyword `typeof` and any tokens following
##[error]  --> /checkout/tests/ui/macros/macro-context.rs:3:17
   |
LL |     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
   |                 ^^^^^^
...
LL |     let i = m!();
   |             ---- caused by the macro expansion here
   |
   = note: the usage of `m!` is likely invalid in expression context

error: macro expansion ignores `;` and any tokens following
##[error]  --> /checkout/tests/ui/macros/macro-context.rs:3:15
   |
LL |     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
   |               ^
...
LL |         m!() => {}
   |         ---- caused by the macro expansion here
   |
   = note: the usage of `m!` is likely invalid in pattern context

error: expected expression, found reserved keyword `typeof`
##[error]  --> /checkout/tests/ui/macros/macro-context.rs:3:17
   |
LL |     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
   |                 ^^^^^^ expected expression
...
LL |     m!();
   |     ---- in this macro invocation
   |
   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0425]: cannot find type `i` in this scope
##[error]  --> /checkout/tests/ui/macros/macro-context.rs:3:13
   |
LL |     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
   |             ^ not found in this scope
...
LL |     let a: m!();
   |            ---- in this macro invocation
   |
   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
help: a builtin type with a similar name exists
   |
LL |     () => ( i8 ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
   |              +

error[E0425]: cannot find value `i` in this scope
##[error]  --> /checkout/tests/ui/macros/macro-context.rs:3:13
   |
LL |     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
   |             ^ not found in this scope
...
LL |     let i = m!();
   |             ---- in this macro invocation
   |
---

- error: macro expansion ignores `assert_eq` and any tokens following
-   --> $DIR/macro-in-expression-context.rs:12:9
-    |
- LL |         assert_eq!("B", "B");
-    |         ^^^^^^^^^
- ...
- LL |     foo!()
-    |     ------ caused by the macro expansion here
-    |
---
25    = note: macro invocations at the end of a block are treated as expressions
26    = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
-    = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default
30    = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
31 
- error: aborting due to 2 previous errors
- 
- Future incompatibility report: Future breakage diagnostic:
- error: trailing semicolon in macro used in expression position
-   --> $DIR/macro-in-expression-context.rs:5:29
+ error: macro expansion ignores `assert_eq` and any tokens following
+   --> $DIR/macro-in-expression-context.rs:12:9
37    |
- LL |         assert_eq!("A", "A");
-    |                             ^
+ LL |         assert_eq!("B", "B");
+    |         ^^^^^^^^^
40 ...
41 LL |     foo!()
-    |     ------ in this macro invocation
+    |     ------ caused by the macro expansion here
43    |
-    = note: macro invocations at the end of a block are treated as expressions
-    = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
-    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
-    = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default
-    = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+    = note: the usage of `foo!` is likely invalid in expression context
+ help: you might be missing a semicolon here
+    |
+ LL |     foo!();
+    |           +
+ 
+ error: aborting due to 2 previous errors
50 
51 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/macros/macro-in-expression-context.rs:12:9
+ error: macro expansion ignores `assert_eq` and any tokens following
+   --> $DIR/macro-in-expression-context.rs:12:9
+ LL |         assert_eq!("B", "B");
+    |         ^^^^^^^^^
+    |     ------ caused by the macro expansion here
+    = note: the usage of `foo!` is likely invalid in expression context
+ help: you might be missing a semicolon here
+    |
---
To only update this specific test, also pass `--test-args macros/macro-in-expression-context.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/macros/macro-in-expression-context.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/macros/macro-in-expression-context" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/macros/macro-in-expression-context.rs:5:29
   |
LL |         assert_eq!("A", "A");
   |                             ^
...
LL |     foo!()
   |     ------ in this macro invocation
   |
   = note: macro invocations at the end of a block are treated as expressions
   = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: macro expansion ignores `assert_eq` and any tokens following
##[error]  --> /checkout/tests/ui/macros/macro-in-expression-context.rs:12:9
   |
LL |         assert_eq!("B", "B");
   |         ^^^^^^^^^
...
LL |     foo!()
   |     ------ caused by the macro expansion here
   |
---
---- [ui] tests/ui/macros/trace_faulty_macros.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/macros/trace_faulty_macros/trace_faulty_macros.stderr`
diff of stderr:

50    = note: expanding `my_recursive_macro! {  }`
51    = note: to `my_recursive_macro! ();`
52 
+ error: trailing semicolon in macro used in expression position
+   --> $DIR/trace_faulty_macros.rs:13:41
+    |
+ LL |         pat_macro!(A{a:a, b:0, c:_, ..});
+    |                                         ^
+ ...
+ LL |     let a = pat_macro!();
+    |             ------------ in this macro invocation
+    |
+    = note: this error originates in the macro `pat_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+ 
53 error: expected expression, found `pat` metavariable
54   --> $DIR/trace_faulty_macros.rs:16:9
55    |

102    = note: expanding `test! { (x, 1+1) }`
103    = note: to `let x = 1+1;`
104 
- error: aborting due to 5 previous errors
+ error: aborting due to 6 previous errors
106 
107 For more information about this error, try `rustc --explain E0774`.
108 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/macros/trace_faulty_macros.rs:13:41
+ error: trailing semicolon in macro used in expression position
+   --> $DIR/trace_faulty_macros.rs:13:41
+    |
+ LL |         pat_macro!(A{a:a, b:0, c:_, ..});
+    |                                         ^
+ ...
+ LL |     let a = pat_macro!();
+    |             ------------ in this macro invocation
+    |
---
To only update this specific test, also pass `--test-args macros/trace_faulty_macros.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/macros/trace_faulty_macros.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/macros/trace_faulty_macros" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "trace-macros"
stdout: none
--- stderr -------------------------------
error: no rules expected `bcd`
##[error]  --> /checkout/tests/ui/macros/trace_faulty_macros.rs:7:26
   |
LL | macro_rules! my_faulty_macro {
   | ---------------------------- when calling this macro
LL |     () => {
LL |         my_faulty_macro!(bcd); //~ ERROR no rules
   |                          ^^^ no rules expected this token in macro call
...
LL |     my_faulty_macro!();
   |     ------------------ in this macro invocation
   |
   = note: while trying to match end of macro
---
   |
LL |     my_faulty_macro!();
   |     ^^^^^^^^^^^^^^^^^^
   |
   = note: expanding `my_faulty_macro! {  }`
   = note: to `my_faulty_macro! (bcd);`
   = note: expanding `my_faulty_macro! { bcd }`

error: recursion limit reached while expanding `my_recursive_macro!`
##[error]  --> /checkout/tests/ui/macros/trace_faulty_macros.rs:22:9
   |
LL |         my_recursive_macro!(); //~ ERROR recursion limit
---
   |
LL |     my_recursive_macro!();
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expanding `my_recursive_macro! {  }`
   = note: to `my_recursive_macro! ();`
   = note: expanding `my_recursive_macro! {  }`
   = note: to `my_recursive_macro! ();`
   = note: expanding `my_recursive_macro! {  }`
   = note: to `my_recursive_macro! ();`
   = note: expanding `my_recursive_macro! {  }`
   = note: to `my_recursive_macro! ();`

error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/macros/trace_faulty_macros.rs:13:41
   |
LL |         pat_macro!(A{a:a, b:0, c:_, ..});
   |                                         ^
...
LL |     let a = pat_macro!();
   |             ------------ in this macro invocation
   |
   = note: this error originates in the macro `pat_macro` (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected expression, found `pat` metavariable
##[error]  --> /checkout/tests/ui/macros/trace_faulty_macros.rs:16:9
   |
LL |         $a //~ ERROR expected expression
   |         ^^ expected expression
...
LL |     let a = pat_macro!();
   |             ------------ in this macro invocation
   |
   = note: this error originates in the macro `pat_macro` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0774]: `derive` may only be applied to `struct`s, `enum`s and `union`s
##[error]  --> /checkout/tests/ui/macros/trace_faulty_macros.rs:42:1
   |
LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s
   | ^^^^^^^^^^^^^^^^ not applicable here
LL | fn use_derive_macro_as_attr() {}
   | -------------------------------- not a `struct`, `enum` or `union`

error: expected expression, found `pat` metavariable
##[error]  --> /checkout/tests/ui/macros/trace_faulty_macros.rs:49:37
   |
LL |     (($p:pat, $e:pat)) => {let $p = $e;}; //~ ERROR expected expression, found `pat` metavariable
   |                                     ^^ expected expression
...
LL |     test!(let x = 1+1);
   |     ------------------ in this macro invocation
   |
---
   |
LL |     let a = pat_macro!();
   |             ^^^^^^^^^^^^
   |
   = note: expanding `pat_macro! {  }`
   = note: to `pat_macro! (A {a : a, b : 0, c : _, ..});`
   = note: expanding `pat_macro! { A {a : a, b : 0, c : _, ..} }`
   = note: to `A {a : a, b : 0, c : _, ..}`

note: trace_macro
  --> /checkout/tests/ui/macros/trace_faulty_macros.rs:53:5
   |
LL |     test!(let x = 1+1);
   |     ^^^^^^^^^^^^^^^^^^
   |
   = note: expanding `test! { let x = 1+1 }`
   = note: to `test! ((x, 1+1))`
   = note: expanding `test! { (x, 1+1) }`
   = note: to `let x = 1+1;`

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0774`.
------------------------------------------

---- [ui] tests/ui/macros/trace_faulty_macros.rs stdout end ----
---- [ui] tests/ui/proc-macro/expand-expr.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/expand-expr/expand-expr.stderr`
diff of stderr:

22 LL | expand_expr_fail!(echo_pm!($));
23    |                            ^ expected expression
24 
+ error: trailing semicolon in macro used in expression position
+   --> $DIR/expand-expr.rs:118:45
+    |
+ LL | expand_expr_is!("string", echo_tts!("string"; hello));
+    |                                             ^
+ 
25 error: macro expansion ignores `hello` and any tokens following
26   --> $DIR/expand-expr.rs:118:47
27    |

55    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`expand_expr`)
56    = note: this error originates in the macro `recursive_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
---
60 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/proc-macro/expand-expr.rs:118:45
- LL | expand_expr_is!("string", echo_tts!("string"; hello)); //~ ERROR: macro expansion ignores `hello` and any tokens following
+ error: trailing semicolon in macro used in expression position
+   --> $DIR/expand-expr.rs:118:45
+    |
+ LL | expand_expr_is!("string", echo_tts!("string"; hello));
+    |                                             ^
+ 
+ error: aborting due to 8 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args proc-macro/expand-expr.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/proc-macro/expand-expr.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/expand-expr" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/expand-expr/auxiliary" "--extern" "expand_expr=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/expand-expr/auxiliary/libexpand_expr.so"
stdout: none
--- stderr -------------------------------
error: expected one of `.`, `?`, or an operator, found `;`
##[error]  --> /checkout/tests/ui/proc-macro/expand-expr.rs:109:27
   |
LL | expand_expr_fail!("string"; hello); //~ ERROR: expected one of `.`, `?`, or an operator, found `;`
   |                           ^ expected one of `.`, `?`, or an operator

error: expected expression, found `$`
##[error]  --> /checkout/tests/ui/proc-macro/expand-expr.rs:112:19
   |
LL | expand_expr_fail!($); //~ ERROR: expected expression, found `$`
   |                   ^ expected expression

error: expected expression, found `$`
##[error]  --> /checkout/tests/ui/proc-macro/expand-expr.rs:113:29
   |
LL | expand_expr_fail!(echo_tts!($)); //~ ERROR: expected expression, found `$`
   |                             ^ expected expression

error: expected expression, found `$`
##[error]  --> /checkout/tests/ui/proc-macro/expand-expr.rs:114:28
   |
LL | expand_expr_fail!(echo_pm!($)); //~ ERROR: expected expression, found `$`
   |                            ^ expected expression

error: trailing semicolon in macro used in expression position
##[error]  --> /checkout/tests/ui/proc-macro/expand-expr.rs:118:45
   |
LL | expand_expr_is!("string", echo_tts!("string"; hello)); //~ ERROR: macro expansion ignores `hello` and any tokens following
   |                                             ^

error: macro expansion ignores `hello` and any tokens following
##[error]  --> /checkout/tests/ui/proc-macro/expand-expr.rs:118:47
   |
LL | expand_expr_is!("string", echo_tts!("string"; hello)); //~ ERROR: macro expansion ignores `hello` and any tokens following
   |                           --------------------^^^^^- caused by the macro expansion here
   |
   = note: the usage of `echo_tts!` is likely invalid in expression context
help: you might be missing a semicolon here
   |
LL | expand_expr_is!("string", echo_tts!("string"; hello);); //~ ERROR: macro expansion ignores `hello` and any tokens following
   |                                                     +

error: macro expansion ignores `;` and any tokens following
##[error]  --> /checkout/tests/ui/proc-macro/expand-expr.rs:119:44
   |
LL | expand_expr_is!("string", echo_pm!("string"; hello)); //~ ERROR: macro expansion ignores `;` and any tokens following
   |                           -----------------^------- caused by the macro expansion here
   |
   = note: the usage of `echo_pm!` is likely invalid in expression context
help: you might be missing a semicolon here
   |
LL | expand_expr_is!("string", echo_pm!("string"; hello);); //~ ERROR: macro expansion ignores `;` and any tokens following
   |                                                    +

error: recursion limit reached while expanding `recursive_expand!`
##[error]  --> /checkout/tests/ui/proc-macro/expand-expr.rs:127:16
   |
LL | const _: u32 = recursive_expand!(); //~ ERROR: recursion limit reached while expanding `recursive_expand!`
   |                ^^^^^^^^^^^^^^^^^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`expand_expr`)
   = note: this error originates in the macro `recursive_expand` (in Nightly builds, run with -Z macro-backtrace for more info)

@RalfJung

Copy link
Copy Markdown
Member Author

@craterbot check

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-162768 created and queued.
🤖 Automatically detected try build c92d9dd
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-crater Status: Waiting on a crater run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants