Skip to content

ICE: assertion failed: layout.is_sized() #146084

@levinwinter

Description

@levinwinter

Code

struct S<const N: [()] = { loop {} }>;

Meta

rustc --version --verbose:

rustc 1.91.0-nightly (07d246fc6 2025-08-31)
binary: rustc
commit-hash: 07d246fc6dc227903da2955b38a59e060539a485
commit-date: 2025-08-31
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0

Error output

thread 'rustc' panicked at compiler/rustc_const_eval/src/const_eval/eval_queries.rs:50:5:
assertion failed: layout.is_sized()
Backtrace

thread 'rustc' panicked at compiler/rustc_const_eval/src/const_eval/eval_queries.rs:50:5:
assertion failed: layout.is_sized()
stack backtrace:
   0:     0x75c468f80ea5 - std::backtrace::Backtrace::create::hd92f617149db8413
   1:     0x75c468f80df5 - std::backtrace::Backtrace::force_capture::ha3666dab88a14d48
   2:     0x75c467fde782 - std[d7852cb937e3e663]::panicking::update_hook::<alloc[d59bcc155c16d232]::boxed::Box<rustc_driver_impl[4d569efedce7d3df]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x75c468f81e5e - std::panicking::panic_with_hook::h5f7ef3efbb7c445c
   4:     0x75c468f81b56 - std::panicking::panic_handler::{{closure}}::h7bc4d3cbd7b0aab4
   5:     0x75c468f7bb59 - std::sys::backtrace::__rust_end_short_backtrace::h4ede48052c8c6d63
   6:     0x75c468f5c40d - __rustc[8dad1328f75840d5]::rust_begin_unwind
   7:     0x75c4656d0e70 - core::panicking::panic_fmt::h77f0421126830b9b
   8:     0x75c4657499ac - core::panicking::panic::h8718f0924cce3d63
   9:     0x75c4698494a8 - rustc_const_eval[69e56d6c110d8f22]::const_eval::eval_queries::eval_to_allocation_raw_provider
  10:     0x75c469846580 - rustc_query_impl[e88f91524e92254e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e88f91524e92254e]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 24usize]>>
  11:     0x75c46982d4e5 - rustc_query_system[f8aab9fcdc4ed859]::query::plumbing::try_execute_query::<rustc_query_impl[e88f91524e92254e]::DynamicConfig<rustc_query_system[f8aab9fcdc4ed859]::query::caches::DefaultCache<rustc_middle[c4b4870dc3ca5f59]::ty::PseudoCanonicalInput<rustc_middle[c4b4870dc3ca5f59]::mir::interpret::GlobalId>, rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[e88f91524e92254e]::plumbing::QueryCtxt, false>
  12:     0x75c46982d07d - rustc_query_impl[e88f91524e92254e]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  13:     0x75c46982c8e2 - rustc_const_eval[69e56d6c110d8f22]::const_eval::valtrees::eval_to_valtree
  14:     0x75c46982c68f - rustc_query_impl[e88f91524e92254e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e88f91524e92254e]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 16usize]>>
  15:     0x75c469911342 - rustc_query_system[f8aab9fcdc4ed859]::query::plumbing::try_execute_query::<rustc_query_impl[e88f91524e92254e]::DynamicConfig<rustc_query_system[f8aab9fcdc4ed859]::query::caches::DefaultCache<rustc_middle[c4b4870dc3ca5f59]::ty::PseudoCanonicalInput<rustc_middle[c4b4870dc3ca5f59]::mir::interpret::GlobalId>, rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[e88f91524e92254e]::plumbing::QueryCtxt, false>
  16:     0x75c469910ef0 - rustc_query_impl[e88f91524e92254e]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  17:     0x75c46990ff02 - <rustc_middle[c4b4870dc3ca5f59]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  18:     0x75c46990eb80 - rustc_trait_selection[d166cff357c9555b]::traits::try_evaluate_const
  19:     0x75c4698f29bb - <rustc_trait_selection[d166cff357c9555b]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[74ee0b1b765dd3bf]::fold::TypeFolder<rustc_middle[c4b4870dc3ca5f59]::ty::context::TyCtxt>>::fold_const
  20:     0x75c46ad1984d - <rustc_trait_selection[d166cff357c9555b]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[74ee0b1b765dd3bf]::fold::TypeFolder<rustc_middle[c4b4870dc3ca5f59]::ty::context::TyCtxt>>::fold_predicate.warm
  21:     0x75c46a42a430 - <rustc_hir_analysis[9e428c2cd38d145]::check::wfcheck::WfCheckingCtxt>::normalize::<rustc_middle[c4b4870dc3ca5f59]::ty::predicate::Clause>
  22:     0x75c469f74604 - rustc_hir_analysis[9e428c2cd38d145]::check::wfcheck::check_where_clauses
  23:     0x75c469eac657 - rustc_hir_analysis[9e428c2cd38d145]::check::wfcheck::check_type_defn
  24:     0x75c46a065d06 - rustc_hir_analysis[9e428c2cd38d145]::check::check::check_item_type
  25:     0x75c46a06145b - rustc_hir_analysis[9e428c2cd38d145]::check::wfcheck::check_well_formed
  26:     0x75c46a061423 - rustc_query_impl[e88f91524e92254e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e88f91524e92254e]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 1usize]>>
  27:     0x75c46a060c63 - rustc_query_system[f8aab9fcdc4ed859]::query::plumbing::try_execute_query::<rustc_query_impl[e88f91524e92254e]::DynamicConfig<rustc_data_structures[c992f76671c0f2c6]::vec_cache::VecCache<rustc_span[1b909fe6aeabbc92]::def_id::LocalDefId, rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[f8aab9fcdc4ed859]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[e88f91524e92254e]::plumbing::QueryCtxt, false>
  28:     0x75c46a060782 - rustc_query_impl[e88f91524e92254e]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  29:     0x75c46a05d72f - rustc_hir_analysis[9e428c2cd38d145]::check::wfcheck::check_type_wf
  30:     0x75c46a05d625 - rustc_query_impl[e88f91524e92254e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e88f91524e92254e]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 1usize]>>
  31:     0x75c46a622ed4 - rustc_query_system[f8aab9fcdc4ed859]::query::plumbing::try_execute_query::<rustc_query_impl[e88f91524e92254e]::DynamicConfig<rustc_query_system[f8aab9fcdc4ed859]::query::caches::SingleCache<rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e88f91524e92254e]::plumbing::QueryCtxt, false>
  32:     0x75c46a622cb6 - rustc_query_impl[e88f91524e92254e]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  33:     0x75c46a0fbe79 - rustc_hir_analysis[9e428c2cd38d145]::check_crate
  34:     0x75c4697e4abe - rustc_interface[fefffe8d2d5dc148]::passes::analysis
  35:     0x75c4697e478b - rustc_query_impl[e88f91524e92254e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e88f91524e92254e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 0usize]>>
  36:     0x75c46a629954 - rustc_query_system[f8aab9fcdc4ed859]::query::plumbing::try_execute_query::<rustc_query_impl[e88f91524e92254e]::DynamicConfig<rustc_query_system[f8aab9fcdc4ed859]::query::caches::SingleCache<rustc_middle[c4b4870dc3ca5f59]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[e88f91524e92254e]::plumbing::QueryCtxt, false>
  37:     0x75c46a62958c - rustc_query_impl[e88f91524e92254e]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x75c46a7c4324 - rustc_interface[fefffe8d2d5dc148]::passes::create_and_enter_global_ctxt::<core[77bc726fc18293b6]::option::Option<rustc_interface[fefffe8d2d5dc148]::queries::Linker>, rustc_driver_impl[4d569efedce7d3df]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  39:     0x75c46a81ec62 - rustc_interface[fefffe8d2d5dc148]::interface::run_compiler::<(), rustc_driver_impl[4d569efedce7d3df]::run_compiler::{closure#0}>::{closure#1}
  40:     0x75c46a700d38 - std[d7852cb937e3e663]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[fefffe8d2d5dc148]::util::run_in_thread_with_globals<rustc_interface[fefffe8d2d5dc148]::util::run_in_thread_pool_with_globals<rustc_interface[fefffe8d2d5dc148]::interface::run_compiler<(), rustc_driver_impl[4d569efedce7d3df]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  41:     0x75c46a700a1c - <<std[d7852cb937e3e663]::thread::Builder>::spawn_unchecked_<rustc_interface[fefffe8d2d5dc148]::util::run_in_thread_with_globals<rustc_interface[fefffe8d2d5dc148]::util::run_in_thread_pool_with_globals<rustc_interface[fefffe8d2d5dc148]::interface::run_compiler<(), rustc_driver_impl[4d569efedce7d3df]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[77bc726fc18293b6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x75c46a7067cd - std::sys::pal::unix::thread::Thread::new::thread_start::haa2ffc93d9a76281
  43:     0x75c46bf7c1f5 - start_thread
                               at ./nptl/pthread_create.c:442:8
  44:     0x75c46bffc89c - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0
  45:                0x0 - <unknown>


rustc version: 1.91.0-nightly (07d246fc6 2025-08-31)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `S::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
#2 [check_well_formed] checking that `S` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on this crate
end of query stack

Bisection

Regression in nightly-2025-02-05

Looking at the bisection output and related issues, it seems possible that #136274 introduced this.

Related issue

#137582 ICEs at the same assertion and with the same query stack. However, the reproducer there is quite different (no loop, more use of structs/impls) and does not involve #![feature(adt_const_params)] (though that feature also no longer seems required to trigger it). I therefore suspect this report may have a different root cause.

Metadata

Metadata

Assignees

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions