Skip to content

Conversation

@natepiano
Copy link
Contributor

@natepiano natepiano commented Jan 23, 2026

Objective

Fix CI failure caused by a rustfmt regression in Rust 1.93.0.

The cargo fmt --all -- --check CI step panics when formatting crates/bevy_reflect/derive/src/from_reflect.rs due to the pattern quote!(Self(#__this)).

Upstream issue: rust-lang/rustfmt#6779

Fixes #22704.

Solution

Pre-construct Self as a separate token stream before using it in the quote! macro:

let self_ty = quote!(Self);
quote!(#self_ty(#__this))  // instead of quote!(Self(#__this))

This produces identical output but avoids the rustfmt parser bug.

Testing

  • cargo fmt --all no longer panics
  • cargo build -p bevy_reflect_derive succeeds
  • cargo nextest run -p bevy_reflect passes all 212 tests

Fixes CI failure in `cargo fmt --all -- --check` caused by a rustfmt
regression in Rust 1.93.0 where `quote!(Self(#interpolated_var))`
triggers a panic.

Upstream issue: rust-lang/rustfmt#6779
@kfc35 kfc35 added C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy A-Build-System Related to build systems or continuous integration S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Reflection Runtime information about types labels Jan 23, 2026
@natepiano
Copy link
Contributor Author

natepiano commented Jan 24, 2026

I created an issue rust-lang/rustfmt/issues/6779. The issue was updated that it is fixed with rust-lang/rust#150590 which I believe is in nightly now and is targeted for 1.94.0 milestone so if we just want to wait for that, then there won't be any need to merge this. If you want CI fixed now, you can merge this - if not, feel free to close this PR.

@mockersf
Copy link
Member

this is not causing a CI failure, cargo is not exiting in error after the ICE and correctly continue to format

@mockersf mockersf removed the A-Build-System Related to build systems or continuous integration label Jan 24, 2026
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 25, 2026
Co-authored-by: François Mockers <francois.mockers@vleue.com>
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 26, 2026
Merged via the queue into bevyengine:main with commit 304265b Jan 26, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Reflection Runtime information about types C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

`cargo fmt panics with an Internal Compiler Error (ICE) on rust v1.93

5 participants