[ICE]: `assertion `left == right` failed: scalar immediate size does not match layout`
Open
@biscuitrescue is already working on this.
Since Aug 24, 2026.
C-bug
F-generic_const_args
F-generic_const_items
F-min_generic_const_args
I-ICE
needs-triage
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
#![feature(generic_const_args)]
#![feature(min_generic_const_args)]
#![feature(generic_const_items)]
trait Owner {
const K<const N: u16>: u32; // oopsie
}
impl Owner for () {
const K<const N: u32>: u32 = N + 1;
}
fn take1(_: impl Owner<K<99> = 100>) {}
fn main() {
take1(());
}
Meta
rustc --version --verbose:
rustc 1.100.0-nightly (b0ca9c712 2026-08-22)
binary: rustc
commit-hash: b0ca9c712455d865c3bf0bf5325a3e79677a2d97
commit-date: 2026-08-22
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.0
Error output
warning: the feature `generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
--> c.rs:1:12
|
1 | #![feature(generic_const_args)]
| ^^^^^^^^^^^^^^^^^^
|
= note: see issue #151972 <https://github.com/rust-lang/rust/issues/151972> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
--> c.rs:2:12
|
2 | #![feature(min_generic_const_args)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
warning: the feature `generic_const_items` is incomplete and may not be safe to use and/or cause compiler crashes
--> c.rs:3:12
|
3 | #![feature(generic_const_items)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
error[E0053]: associated constant `K` has an incompatible generic parameter for trait `Owner`
--> c.rs:10:13
|
5 | trait Owner {
| -----
6 | const K<const N: u16>: u32; // oopsie
| ------------ expected const parameter of type `u16`
...
9 | impl Owner for () {
| -----------------
10 | const K<const N: u32>: u32 = N + 1;
| ^^^^^^^^^^^^ found const parameter of type `u32`
Backtrace
thread 'rustc' (3838604) panicked at /rustc-dev/b0ca9c712455d865c3bf0bf5325a3e79677a2d97/compiler/rustc_const_eval/src/interpret/operand.rs:344:9:
assertion `left == right` failed: scalar immediate size does not match layout
left: Size(4 bytes)
right: Size(2 bytes)
stack backtrace:
0: 0x7f2e6a9fc246 - <<std[29541300fb290a5d]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[460910d47b72e8ee]::fmt::Display>::fmt
1: 0x7f2e6b00b023 - core[460910d47b72e8ee]::fmt::write
2: 0x7f2e6aa1172c - <std[29541300fb290a5d]::sys::stdio::unix::Stderr as core[460910d47b72e8ee]::io::write::Write>::write_fmt
3: 0x7f2e6a9cf61a - std[29541300fb290a5d]::panicking::default_hook::{closure#0}
4: 0x7f2e6a9f04a3 - std[29541300fb290a5d]::panicking::default_hook
5: 0x7f2e699a89aa - std[29541300fb290a5d]::panicking::update_hook::<alloc[e06df03e17637ff3]::boxed::Box<rustc_driver_impl[56abbf040ce8585c]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f2e6a9f0942 - std[29541300fb290a5d]::panicking::panic_with_hook
7: 0x7f2e6a9cf6d2 - std[29541300fb290a5d]::panicking::panic_handler::{closure#0}
8: 0x7f2e6a9c6509 - std[29541300fb290a5d]::sys::backtrace::__rust_end_short_backtrace::<std[29541300fb290a5d]::panicking::panic_handler::{closure#0}, !>
9: 0x7f2e6a9d100d - __rustc[764f694db36a77d7]::rust_begin_unwind
10: 0x7f2e677aae3c - core[460910d47b72e8ee]::panicking::panic_fmt
11: 0x7f2e6933d383 - core[460910d47b72e8ee]::panicking::assert_failed_inner
12: 0x7f2e69f33dfd - core[460910d47b72e8ee]::panicking::assert_failed::<rustc_abi[38274a54e41d47f6]::Size, rustc_abi[38274a54e41d47f6]::Size>
13: 0x7f2e6b0ad37f - <rustc_const_eval[3248d794e347f168]::interpret::eval_context::InterpCx<rustc_const_eval[3248d794e347f168]::const_eval::machine::CompileTimeMachine>>::binary_op
14: 0x7f2e68bfdb08 - <rustc_const_eval[3248d794e347f168]::interpret::eval_context::InterpCx<rustc_const_eval[3248d794e347f168]::const_eval::machine::CompileTimeMachine>>::eval_rvalue_into_place
15: 0x7f2e68bf5f13 - rustc_const_eval[3248d794e347f168]::const_eval::eval_queries::eval_to_allocation_raw_provider
16: 0x7f2e6b03bb56 - rustc_query_impl[a298bd9aef25de82]::query_vtables::eval_to_allocation_raw::invoke_provider_fn::__rust_begin_short_backtrace
17: 0x7f2e6c0856ba - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::DefaultCache<rustc_middle[9d9ea3708d6e93f5]::ty::PseudoCanonicalInput<rustc_middle[9d9ea3708d6e93f5]::mir::interpret::GlobalId>, rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 24usize]>>, false>
18: 0x7f2e6c084c27 - rustc_query_impl[a298bd9aef25de82]::query_vtables::eval_to_allocation_raw::execute_query_non_incr::__rust_end_short_backtrace
19: 0x7f2e68bf371b - rustc_const_eval[3248d794e347f168]::const_eval::eval_queries::eval_to_allocation_raw_provider
20: 0x7f2e6b03bb56 - rustc_query_impl[a298bd9aef25de82]::query_vtables::eval_to_allocation_raw::invoke_provider_fn::__rust_begin_short_backtrace
21: 0x7f2e6c0856ba - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::DefaultCache<rustc_middle[9d9ea3708d6e93f5]::ty::PseudoCanonicalInput<rustc_middle[9d9ea3708d6e93f5]::mir::interpret::GlobalId>, rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 24usize]>>, false>
22: 0x7f2e6c084c27 - rustc_query_impl[a298bd9aef25de82]::query_vtables::eval_to_allocation_raw::execute_query_non_incr::__rust_end_short_backtrace
23: 0x7f2e681ffb27 - rustc_const_eval[3248d794e347f168]::const_eval::valtrees::eval_to_valtree
24: 0x7f2e6bdf08e6 - <rustc_const_eval[3248d794e347f168]::provide::{closure#0} as core[460910d47b72e8ee]::ops::function::FnOnce<(rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt, rustc_middle[9d9ea3708d6e93f5]::ty::PseudoCanonicalInput<rustc_middle[9d9ea3708d6e93f5]::mir::interpret::GlobalId>)>>::call_once
25: 0x7f2e6bdf08a2 - rustc_query_impl[a298bd9aef25de82]::query_vtables::eval_to_valtree::invoke_provider_fn::__rust_begin_short_backtrace
26: 0x7f2e6bdeff76 - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::DefaultCache<rustc_middle[9d9ea3708d6e93f5]::ty::PseudoCanonicalInput<rustc_middle[9d9ea3708d6e93f5]::mir::interpret::GlobalId>, rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 16usize]>>, false>
27: 0x7f2e6bdefc3f - rustc_query_impl[a298bd9aef25de82]::query_vtables::eval_to_valtree::execute_query_non_incr::__rust_end_short_backtrace
28: 0x7f2e6b13ef31 - <rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
29: 0x7f2e6b13ea3e - <rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
30: 0x7f2e6b13dd3e - <rustc_next_trait_solver[3ac613325c057388]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[6d6a1773eb45fa07]::solve::delegate::SolverDelegate, rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::evaluate_const
31: 0x7f2e6b12a3b5 - <rustc_next_trait_solver[3ac613325c057388]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[6d6a1773eb45fa07]::solve::delegate::SolverDelegate, rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::evaluate_const_and_instantiate_projection_term
32: 0x7f2e6c7a907b - <rustc_next_trait_solver[3ac613325c057388]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[6d6a1773eb45fa07]::solve::delegate::SolverDelegate, rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::assemble_and_evaluate_candidates::<rustc_type_ir[c55ed8222f6694be]::predicate::NormalizesTo<rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>
33: 0x7f2e67e65186 - <rustc_type_ir[c55ed8222f6694be]::search_graph::SearchGraph<rustc_next_trait_solver[3ac613325c057388]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[6d6a1773eb45fa07]::solve::delegate::SolverDelegate>, rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::evaluate_goal::{closure#0}
34: 0x7f2e6bf88828 - <rustc_next_trait_solver[3ac613325c057388]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[6d6a1773eb45fa07]::solve::delegate::SolverDelegate, rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::evaluate_goal_raw
35: 0x7f2e67e644b4 - <rustc_type_ir[c55ed8222f6694be]::search_graph::SearchGraph<rustc_next_trait_solver[3ac613325c057388]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[6d6a1773eb45fa07]::solve::delegate::SolverDelegate>, rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::evaluate_goal::{closure#0}
36: 0x7f2e6be338e7 - <rustc_next_trait_solver[3ac613325c057388]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[6d6a1773eb45fa07]::solve::delegate::SolverDelegate, rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::evaluate_goal_no_fast_paths
37: 0x7f2e6b00f681 - <rustc_trait_selection[6d6a1773eb45fa07]::traits::engine::FulfillmentEngine<rustc_trait_selection[6d6a1773eb45fa07]::traits::FulfillmentError> as rustc_infer[775c003696668d9d]::traits::engine::TraitEngine<rustc_trait_selection[6d6a1773eb45fa07]::traits::FulfillmentError>>::try_evaluate_obligations
38: 0x7f2e6b1acbdb - <rustc_hir_typeck[87e1a5cf58e3b38c]::fn_ctxt::FnCtxt>::check_expr_call
39: 0x7f2e6b9d453d - <rustc_hir_typeck[87e1a5cf58e3b38c]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
40: 0x7f2e6b9ce32b - <rustc_hir_typeck[87e1a5cf58e3b38c]::fn_ctxt::FnCtxt>::check_expr_block
41: 0x7f2e6b9d455a - <rustc_hir_typeck[87e1a5cf58e3b38c]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
42: 0x7f2e6b165867 - rustc_hir_typeck[87e1a5cf58e3b38c]::check::check_fn
43: 0x7f2e6bb521a5 - rustc_hir_typeck[87e1a5cf58e3b38c]::typeck_with_inspect::{closure#0}
44: 0x7f2e6bb5073c - rustc_query_impl[a298bd9aef25de82]::query_vtables::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
45: 0x7f2e6bb2abb5 - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_data_structures[ce2d1b2e5f4b9540]::vec_cache::VecCache<rustc_span[7b0e571682104a6f]::def_id::LocalDefId, rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[9d9ea3708d6e93f5]::dep_graph::graph::DepNodeIndex>, false>
46: 0x7f2e6bb2a827 - rustc_query_impl[a298bd9aef25de82]::query_vtables::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
47: 0x7f2e6b879114 - rustc_hir_analysis[30f31704cfa60f6c]::check_crate
48: 0x7f2e6bb2c0ba - rustc_interface[473d810ada35544b]::passes::analysis
49: 0x7f2e6c21354a - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::SingleCache<rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 0usize]>>, false>
50: 0x7f2e6c2132eb - rustc_query_impl[a298bd9aef25de82]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
51: 0x7f2e6c385c6b - rustc_interface[473d810ada35544b]::interface::run_compiler::<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}
52: 0x7f2e6c3d7582 - std[29541300fb290a5d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[473d810ada35544b]::util::run_in_thread_with_globals<rustc_interface[473d810ada35544b]::util::run_in_thread_pool_with_globals<rustc_interface[473d810ada35544b]::interface::run_compiler<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
53: 0x7f2e6c3d732d - <std[29541300fb290a5d]::thread::lifecycle::spawn_unchecked<rustc_interface[473d810ada35544b]::util::run_in_thread_with_globals<rustc_interface[473d810ada35544b]::util::run_in_thread_pool_with_globals<rustc_interface[473d810ada35544b]::interface::run_compiler<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[460910d47b72e8ee]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
54: 0x7f2e6c3d4d87 - <std[29541300fb290a5d]::sys::thread::unix::Thread>::new::thread_start
55: 0x7f2e65697739 - <unknown>
56: 0x7f2e6571bedc - <unknown>
57: 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: please attach the file at `/tmp/im/rustc-ice-2026-08-22T14_13_08-3838602.txt` to your bug report
note: rustc 1.100.0-nightly (b0ca9c712 2026-08-22) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at c.rs:9:1: 9:18>::K`
#1 [eval_to_allocation_raw] const-evaluating + checking `<impl at c.rs:9:1: 9:18>::K`
#2 [eval_to_valtree] evaluating type-level constant
#3 [typeck_root] type-checking `main`
#4 [analysis] running analysis passes on crate `c`
end of query stack
error: aborting due to 1 previous error; 3 warnings emitted
For more information about this error, try `rustc --explain E0053`.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.