ICE running cargo fmt in bevy repo
rustc-ice-2025-12-06T03_03_24-4684.txt
My repo at the time: https://github.com/TeamDman/bevy/tree/rust-ice-2025-12-05 (permalink)
bevywinicon on rust-ice-2025-12-05 [$] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly
❯ cargo fmt
thread 'main' (35988) panicked at compiler\rustc_parse\src\parser\item.rs:400:32:
called `Result::unwrap()` on an `Err` value: Some(DiagInner { level: Error, messages: [(FluentIdentifier("parse_expected_identifier_found_keyword_str", None), NoStyle)], code: None, lint_id: None, span: MultiSpan
{ primary_spans: [Span { lo: BytePos(139697), hi: BytePos(139701), ctxt: #0 }], span_labels: [(Span { lo: BytePos(139697), hi: BytePos(139701), ctxt: #0 }, Translated("expected identifier, found keyword"))] }, children: [], suggestions: Enabled([]), args: {"token": Str("Self")}, reserved_args: {}, sort_span: Span { lo: BytePos(139697), hi: BytePos(139701), ctxt: #0 }, is_lint: None, long_ty_path: None, emitted_at: DiagLocation { file: "compiler\\rustc_parse\\src\\parser\\diagnostics.rs", line: 381, col: 34 } })
bevywinicon on rust-ice-2025-12-05 [$] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly took 6s
❯ rustc --version
rustc 1.94.0-nightly (1aa9bab4e 2025-12-05)
bevywinicon on rust-ice-2025-12-05 [$] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly
❯ cargo --version
cargo 1.94.0-nightly (2c283a9a5 2025-12-04)
bevywinicon on rust-ice-2025-12-05 [$] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly
❯ rustup --version
rustup 1.28.2 (e4f3ad6f8 2025-04-28)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.94.0-nightly (1aa9bab4e 2025-12-05)`
bevywinicon on rust-ice-2025-12-05 [$] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly
❯ pwd
Path
----
D:\bevywinicon
bevywinicon on rust-ice-2025-12-05 [$] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly
❯ git status
On branch rust-ice-2025-12-05
Your branch is up to date with 'mine/rust-ice-2025-12-05'.
nothing to commit, working tree clean
bevywinicon on rust-ice-2025-12-05 [$] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly
❯ git log
commit ee86d092937e6f0f678c4773a309a2f0bd57f83f (HEAD -> rust-ice-2025-12-05, mine/rust-ice-2025-12-05, feat/window-icon-v3)
Author: TeamDman <[email protected]>
Date: Fri Dec 5 22:06:46 2025 -0500
Fix formatting
Observed this after doing rustup update after experiencing https://github.com/rust-lang/rustfmt/issues/5975 lol
still happens after cargo clean
narrowed it down, it only ICEs when the members being formatted includes bevy_reflect_derive
cargo fmt -p bevy_reflect_derive
Minimal reproduction:
bruh/repro2.rs:
use proc_macro2::{Ident, Span};
use quote::quote;
fn reproduce() {
let __this = Ident::new("__this", Span::call_site());
let _ = quote!(Self(#__this));
}
crates\bevy_reflect\derive on rust-ice-2025-12-05 [$?⇡] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly
❯ rustfmt .\bruh\repro2.rs
thread 'main' (14408) panicked at compiler\rustc_parse\src\parser\item.rs:400:32:
called `Result::unwrap()` on an `Err` value: Some(DiagInner { level: Error, messages: [(FluentIdentifier("parse_expected_identifier_found_keyword_str", None), NoStyle)],
code: None, lint_id: None, span: MultiSpan { primary_spans: [Span { lo: BytePos(145), hi: BytePos(149), ctxt: #0 }], span_labels: [(Span { lo: BytePos(145), hi: BytePos(149), ctxt: #0 }, Translated("expected identifier, found keyword"))] }, children: [], suggestions: Enabled([]), args: {"token": Str("Self")}, reserved_args: {}, sort_span: Span { lo: BytePos(145), hi: BytePos(149), ctxt: #0 }, is_lint: None, long_ty_path: None, emitted_at: DiagLocation { file: "compiler\\rustc_parse\\src\\parser\\diagnostics.rs", line: 381, col: 34 } })
stack backtrace:
0: 0x7ffd8acd4f92 - std::backtrace_rs::backtrace::win64::trace
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
1: 0x7ffd8acd4f92 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ffd8acd4f92 - std::sys::backtrace::_print_fmt
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\sys\backtrace.rs:68
3: 0x7ffd8acd4f92 - std::sys::backtrace::impl$0::print::impl$0::fmt
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\sys\backtrace.rs:38
4: 0x7ffd8acfd241 - core::fmt::write
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\core\src\fmt\mod.rs:0
5: 0x7ffd8ace5144 - std::io::default_write_fmt
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\io\mod.rs:614
6: 0x7ffd8ace5144 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\io\mod.rs:1969
7: 0x7ffd8acaedce - std::sys::backtrace::BacktraceLock::print
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\sys\backtrace.rs:41
8: 0x7ffd8acaedce - std::panicking::default_hook::closure$0
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\panicking.rs:292
9: 0x7ffd8acc86d7 - std::panicking::default_hook
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\panicking.rs:319
10: 0x7ffd8c4a3c5d - core[9e425223ee68c027]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[cf9623aa3d863903]::Level, &str), usize), <((rustc_lint_defs[cf9623aa3d863903]::Level, &str), usize) as core[9e425223ee68c027]::cmp::PartialOrd>::lt>
11: 0x7ffd8acc89e1 - std::panicking::panic_with_hook
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\panicking.rs:833
12: 0x7ffd8acaeea4 - std::panicking::panic_handler::closure$0
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\panicking.rs:698
13: 0x7ffd8acac2ff - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::panic_handler::closure_env$0,never$>
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\sys\backtrace.rs:176
14: 0x7ffd8acafa5e - std::panicking::panic_handler
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\panicking.rs:689
15: 0x7ffd8edaf95d - core::panicking::panic_fmt
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\core\src\panicking.rs:80
16: 0x7ffd8edaf5f7 - core::result::unwrap_failed
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\core\src\result.rs:1867
17: 0x7ffd8c22917f - <rustc_parse[917f9efb9f2b7a86]::parser::Parser>::parse_item
18: 0x7ffd8c211da7 - <rustc_parse[917f9efb9f2b7a86]::parser::Parser>::parse_item
19: 0x7ffd8c211832 - <rustc_parse[917f9efb9f2b7a86]::parser::Parser>::parse_item
20: 0x7ffd8c21f8eb - <rustc_parse[917f9efb9f2b7a86]::parser::Parser>::parse_item
21: 0x7ffd8c205fb6 - <rustc_parse[917f9efb9f2b7a86]::parser::Parser>::parse_item
22: 0x7ff75f0e3a09 - <unknown>
23: 0x7ff75f0c660f - <unknown>
24: 0x7ff75f09ff0b - <unknown>
25: 0x7ff75efe069b - <unknown>
26: 0x7ff75efe374e - <unknown>
27: 0x7ff75f0e6c13 - <unknown>
28: 0x7ff75f0ab2a0 - <unknown>
29: 0x7ff75f038cbd - <unknown>
30: 0x7ff75f039456 - <unknown>
31: 0x7ff75f03c918 - <unknown>
32: 0x7ff75f03ed6e - <unknown>
33: 0x7ff75f03763f - <unknown>
34: 0x7ff75f08ffc3 - <unknown>
35: 0x7ff75f03d579 - <unknown>
36: 0x7ff75f03e0cf - <unknown>
37: 0x7ff75ef86bbd - <unknown>
38: 0x7ff75ef811b1 - <unknown>
39: 0x7ff75ef987f7 - <unknown>
40: 0x7ff75ef94a23 - <unknown>
41: 0x7ff75ef934d6 - <unknown>
42: 0x7ff75ef93b5c - <unknown>
43: 0x7ffd8acc627f - std::rt::lang_start_internal::closure$0
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\rt.rs:175
44: 0x7ffd8acc627f - std::panicking::catch_unwind::do_call
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\panicking.rs:581
45: 0x7ffd8acc627f - std::panicking::catch_unwind
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\panicking.rs:544
46: 0x7ffd8acc627f - std::panic::catch_unwind
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\panic.rs:359
47: 0x7ffd8acc627f - std::rt::lang_start_internal
at /rustc/1aa9bab4ecbce4859eaad53000f78158ebe2be2c/library\std\src\rt.rs:171
48: 0x7ff75efa563c - <unknown>
49: 0x7ff75f299960 - <unknown>
50: 0x7ffe89e57374 - BaseThreadInitThunk
51: 0x7ffe8ad7cc91 - RtlUserThreadStart
error: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rustfmt/issues/new?labels=bug
note: please make sure that you have updated to the latest nightly
note: please attach the file at `D:\bevywinicon\crates\bevy_reflect\derive\rustc-ice-2025-12-06T04_47_18-37484.txt` to your bug report
query stack during panic:
end of query stack
crates\bevy_reflect\derive on rust-ice-2025-12-05 [$?⇡] is 📦 v0.18.0-dev via 🦀 v1.94.0-nightly
Likely the same bug, but reporting another reproducer for completeness:
m!(impl() { Self {} });
What version of rustfmt are you using? Also, what rust language edition and what rustfmt style_edition are you using? Are there any other non default rustfmt configurations that you might be using?
I'm unable to reproduce a panic with either input
$ cat test.rs
m!(impl() { Self {} });
$ rustfmt test.rs 2>&1 | head -10
thread 'main' (547263) panicked at compiler/rustc_parse/src/parser/item.rs:400:32:
called `Result::unwrap()` on an `Err` value: Some(DiagInner { level: Error, messages: [(FluentIdentifier("parse_expected_identifier_found_keyword_str", None), NoStyle)], code: None, lint_id: None, span: MultiSpan { primary_spans: [Span { lo: BytePos(12), hi: BytePos(16), ctxt: #0 }], span_labels: [(Span { lo: BytePos(12), hi: BytePos(16), ctxt: #0 }, Translated("expected identifier, found keyword"))] }, children: [], suggestions: Enabled([]), args: {"token": Str("Self")}, reserved_args: {}, sort_span: Span { lo: BytePos(12), hi: BytePos(16), ctxt: #0 }, is_lint: None, long_ty_path: None, emitted_at: DiagLocation { file: "compiler/rustc_parse/src/parser/diagnostics.rs", line: 377, col: 34 } })
stack backtrace:
0: 0x7f1377c92423 - <<std[19bff2fd2f0e7e93]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[41fcfb9d91f546ab]::fmt::Display>::fmt
1: 0x7f1378410648 - core[41fcfb9d91f546ab]::fmt::write
2: 0x7f1377ca8b46 - <std[19bff2fd2f0e7e93]::sys::stdio::unix::Stderr as std[19bff2fd2f0e7e93]::io::Write>::write_fmt
3: 0x7f1377c68be8 - std[19bff2fd2f0e7e93]::panicking::default_hook::{closure#0}
4: 0x7f1377c862f3 - std[19bff2fd2f0e7e93]::panicking::default_hook
5: 0x7f1376ce20f7 - std[19bff2fd2f0e7e93]::panicking::update_hook::<alloc[302afdf8e5ea1d8d]::boxed::Box<rustc_driver_impl[9200c1d6e7bd02c7]::install_ice_hook::{closure#1}>>::{closure#0}
$ rustfmt -V
rustfmt 1.8.0-nightly (ba2142a19c 2025-12-07)
Is the panic reproducible with earlier nighty versions? Just based off the panic message this looks like a parser error, which isn't controlled by rustfmt. That's upstream in the compiler. Maybe something changed on nightly
Upstream ICE is https://github.com/rust-lang/rust/issues/149692. I don't think this is a rustfmt side issue, it's a rustc parser ICE. Closing in favor of upstream bug report.
EDIT: hm, interesting, there's a difference in how rustfmt is using rustc_parse,
m!(impl() { Self {} });
doesn't directly ICE if I run it with nightly rustc. It's almost definitely related, but not exactly the same. Same goes for the proc macro example.
I'm unable to reproduce a panic with either input
I can repro with rustfmt 1.8.0-nightly (21ff67df15 2025-12-15) with m!(impl() { Self {} });
Upstream parser ICE MCVE:
macro_rules! m {
($id:item()) => {}
}
m!(Self());