-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
auto-reduced (treereduce-rust):
enum Foo {
Bar {
a: isize,
b: isize
},
}
pub fn main() {
let _x = Foo::Bar { a 2, a: 2 };
}original:
//@ run-pass
#![allow(dead_code)]
enum Foo {
Bar {
a: isize,
b: isize
},
Bar {
a: isize,
b: isize
}
}
pub fn main() {
let _x = Foo::Bar { a 2, a: 2 };
}Version information
rustc 1.96.0-nightly (d933cf483 2026-03-04)
binary: rustc
commit-hash: d933cf483edf1605142ac6899ff32536c0ad8b22
commit-date: 2026-03-04
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0
Possibly related line of code:
rust/compiler/rustc_mir_build/src/thir/cx/expr.rs
Lines 638 to 650 in d933cf4
| })) | |
| } | |
| AdtKind::Enum => { | |
| let res = self.typeck_results.qpath_res(qpath, expr.hir_id); | |
| match res { | |
| Res::Def(DefKind::Variant, variant_id) => { | |
| assert!(matches!( | |
| base, | |
| hir::StructTailExpr::None | |
| | hir::StructTailExpr::DefaultFields(_) | |
| )); | |
| let index = adt.variant_index_with_id(variant_id); |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error: expected one of `,`, `:`, or `}`, found `2`
--> /tmp/icemaker_global_tempdir.r1xLbR40qvxd/rustc_testrunner_tmpdir_reporting.tdQG2xeni9eW/mvce.rs:13:27
|
13 | let _x = Foo::Bar { a 2, a: 2 };
| -------- - ^ expected one of `,`, `:`, or `}`
| | |
| | while parsing this struct field
| while parsing this struct
thread 'rustc' (1145449) panicked at /rustc-dev/d933cf483edf1605142ac6899ff32536c0ad8b22/compiler/rustc_mir_build/src/thir/cx/expr.rs:644:33:
assertion failed: matches!(base, hir::StructTailExpr::None |
hir::StructTailExpr::DefaultFields(_))
stack backtrace:
0: 0x7fa01bb5ef7b - <<std[69d51b4813ba037]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[51d4adbef590f61]::fmt::Display>::fmt
1: 0x7fa01c2229c8 - core[51d4adbef590f61]::fmt::write
2: 0x7fa01bb75f86 - <std[69d51b4813ba037]::sys::stdio::unix::Stderr as std[69d51b4813ba037]::io::Write>::write_fmt
3: 0x7fa01bb35058 - std[69d51b4813ba037]::panicking::default_hook::{closure#0}
4: 0x7fa01bb523e3 - std[69d51b4813ba037]::panicking::default_hook
5: 0x7fa01ab3d71c - std[69d51b4813ba037]::panicking::update_hook::<alloc[18203fec9a0cd4ec]::boxed::Box<rustc_driver_impl[9032f3c5cdcc149c]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7fa01bb526c2 - std[69d51b4813ba037]::panicking::panic_with_hook
7: 0x7fa01bb3514a - std[69d51b4813ba037]::panicking::panic_handler::{closure#0}
8: 0x7fa01bb2be49 - std[69d51b4813ba037]::sys::backtrace::__rust_end_short_backtrace::<std[69d51b4813ba037]::panicking::panic_handler::{closure#0}, !>
9: 0x7fa01bb36b7d - __rustc[cb16bc19fc993bd7]::rust_begin_unwind
10: 0x7fa01871895c - core[51d4adbef590f61]::panicking::panic_fmt
11: 0x7fa0181fea02 - core[51d4adbef590f61]::panicking::panic
12: 0x7fa01cd40c6a - <rustc_mir_build[343fb3c24b208ffc]::thir::cx::ThirBuildCx>::mirror_expr
13: 0x7fa01cd39823 - <rustc_mir_build[343fb3c24b208ffc]::thir::cx::ThirBuildCx>::mirror_stmts::{closure#0}
14: 0x7fa01cd3aee0 - <rustc_mir_build[343fb3c24b208ffc]::thir::cx::ThirBuildCx>::mirror_expr
15: 0x7fa01cd37320 - rustc_mir_build[343fb3c24b208ffc]::thir::cx::thir_body
16: 0x7fa01cd36624 - rustc_query_impl[540cdfee4f8a4756]::query_impl::thir_body::invoke_provider_fn::__rust_begin_short_backtrace
17: 0x7fa01cc14574 - rustc_query_impl[540cdfee4f8a4756]::execution::try_execute_query::<rustc_data_structures[889238d3fa4068cd]::vec_cache::VecCache<rustc_span[a0277d8dc90b615]::def_id::LocalDefId, rustc_middle[7e63d2df2dd45427]::query::erase::ErasedData<[u8; 16usize]>, rustc_middle[7e63d2df2dd45427]::dep_graph::graph::DepNodeIndex>, false>
18: 0x7fa01cc141c3 - rustc_query_impl[540cdfee4f8a4756]::query_impl::thir_body::execute_query_non_incr::__rust_end_short_backtrace
19: 0x7fa01900dab6 - rustc_mir_build[343fb3c24b208ffc]::check_unsafety::check_unsafety
20: 0x7fa01c26741f - rustc_query_impl[540cdfee4f8a4756]::execution::try_execute_query::<rustc_data_structures[889238d3fa4068cd]::vec_cache::VecCache<rustc_span[a0277d8dc90b615]::def_id::LocalDefId, rustc_middle[7e63d2df2dd45427]::query::erase::ErasedData<[u8; 0usize]>, rustc_middle[7e63d2df2dd45427]::dep_graph::graph::DepNodeIndex>, false>
21: 0x7fa01c267176 - rustc_query_impl[540cdfee4f8a4756]::query_impl::check_unsafety::execute_query_non_incr::__rust_end_short_backtrace
22: 0x7fa01c26646a - <rustc_middle[7e63d2df2dd45427]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[5b554394f8ce662a]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
23: 0x7fa01c265ab5 - rustc_interface[5b554394f8ce662a]::passes::analysis
24: 0x7fa01d491c1c - rustc_query_impl[540cdfee4f8a4756]::execution::try_execute_query::<rustc_middle[7e63d2df2dd45427]::query::caches::SingleCache<rustc_middle[7e63d2df2dd45427]::query::erase::ErasedData<[u8; 0usize]>>, false>
25: 0x7fa01d49197b - rustc_query_impl[540cdfee4f8a4756]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
26: 0x7fa01d4329ed - rustc_interface[5b554394f8ce662a]::interface::run_compiler::<(), rustc_driver_impl[9032f3c5cdcc149c]::run_compiler::{closure#0}>::{closure#1}
27: 0x7fa01d45c6fe - std[69d51b4813ba037]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5b554394f8ce662a]::util::run_in_thread_with_globals<rustc_interface[5b554394f8ce662a]::util::run_in_thread_pool_with_globals<rustc_interface[5b554394f8ce662a]::interface::run_compiler<(), rustc_driver_impl[9032f3c5cdcc149c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
28: 0x7fa01d45cd60 - <std[69d51b4813ba037]::thread::lifecycle::spawn_unchecked<rustc_interface[5b554394f8ce662a]::util::run_in_thread_with_globals<rustc_interface[5b554394f8ce662a]::util::run_in_thread_pool_with_globals<rustc_interface[5b554394f8ce662a]::interface::run_compiler<(), rustc_driver_impl[9032f3c5cdcc149c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[51d4adbef590f61]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
29: 0x7fa01d45dbec - <std[69d51b4813ba037]::sys::thread::unix::Thread>::new::thread_start
30: 0x7fa016ea598b - <unknown>
31: 0x7fa016f29a0c - <unknown>
32: 0x0 - <unknown>
error: the compiler unexpectedly panicked. This is a bug
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: please make sure that you have updated to the latest nightly
note: rustc 1.96.0-nightly (d933cf483 2026-03-04) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [thir_body] building THIR for `main`
#1 [check_unsafety] unsafety-checking `main`
#2 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 1 previous error
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.