-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
It is similar to #137582, but this example seems to require specialization, and I'm not sure if it is a duplicate.
Code
#![feature(adt_const_params)]
#![feature(unsized_const_params)]
#[derive(Clone)]
struct S<const L: [u8]>;
const A: [u8];
impl<const N: i32> Copy for S<A> {}
impl<const M: usize> Copy for S<A> {}
fn main() {}Meta
rustc --version --verbose:
rustc 1.95.0-nightly (d222ddc4d 2026-01-23)
binary: rustc
commit-hash: d222ddc4d90743dfc1e53b610be8fc9d95893d2c
commit-date: 2026-01-23
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8
Program Output
error: free constant item without body
--> <source>:55:1
|
55 | const A: [u8];
| ^^^^^^^^^^^^^-
| |
| help: provide a definition for the constant: `= <expr>;`
warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
--> <source>:50:12
|
50 | #![feature(unsized_const_params)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> <source>:55:10
|
55 | const A: [u8];
| ^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
= note: statics and constants must have a statically known size
thread 'rustc' (3) panicked at /rustc-dev/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/compiler/rustc_const_eval/src/const_eval/eval_queries.rs:47:5:
assertion failed: layout.is_sized()
stack backtrace:
0: 0x793d98828123 - <<std[f475c8dea6bc1f1c]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[61603b96a07b8ff9]::fmt::Display>::fmt
1: 0x793d98e0e688 - core[61603b96a07b8ff9]::fmt::write
2: 0x793d9883e8b6 - <std[f475c8dea6bc1f1c]::sys::stdio::unix::Stderr as std[f475c8dea6bc1f1c]::io::Write>::write_fmt
3: 0x793d987fe128 - std[f475c8dea6bc1f1c]::panicking::default_hook::{closure#0}
4: 0x793d9881b883 - std[f475c8dea6bc1f1c]::panicking::default_hook
5: 0x793d9780a60d - std[f475c8dea6bc1f1c]::panicking::update_hook::<alloc[cd9c1527bed1fc96]::boxed::Box<rustc_driver_impl[5f67874deb35e28a]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x793d9881bb62 - std[f475c8dea6bc1f1c]::panicking::panic_with_hook
7: 0x793d987fe21a - std[f475c8dea6bc1f1c]::panicking::panic_handler::{closure#0}
8: 0x793d987f4f39 - std[f475c8dea6bc1f1c]::sys::backtrace::__rust_end_short_backtrace::<std[f475c8dea6bc1f1c]::panicking::panic_handler::{closure#0}, !>
9: 0x793d987ffcbd - __rustc[b9cd6962f6f9a39e]::rust_begin_unwind
10: 0x793d954f061c - core[61603b96a07b8ff9]::panicking::panic_fmt
11: 0x793d94fdacb2 - core[61603b96a07b8ff9]::panicking::panic
12: 0x793d99e9c30b - rustc_const_eval[5bafb0826f006450]::const_eval::eval_queries::setup_for_eval
13: 0x793d99e9ec0d - rustc_const_eval[5bafb0826f006450]::const_eval::eval_queries::eval_to_allocation_raw_provider
14: 0x793d99e9e182 - rustc_query_impl[bf9f47c0be6c5cea]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf9f47c0be6c5cea]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 24usize]>>
15: 0x793d99e9d4a5 - rustc_query_system[c53c5369b4d54c12]::query::plumbing::try_execute_query::<rustc_query_impl[bf9f47c0be6c5cea]::DynamicConfig<rustc_query_system[c53c5369b4d54c12]::query::caches::DefaultCache<rustc_middle[323d677696c3953f]::ty::PseudoCanonicalInput<rustc_middle[323d677696c3953f]::mir::interpret::GlobalId>, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[bf9f47c0be6c5cea]::plumbing::QueryCtxt, false>
16: 0x793d99e9d049 - rustc_query_impl[bf9f47c0be6c5cea]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
17: 0x793d992e9605 - rustc_const_eval[5bafb0826f006450]::const_eval::valtrees::eval_to_valtree
18: 0x793d992e93b6 - <rustc_const_eval[5bafb0826f006450]::provide::{closure#0} as core[61603b96a07b8ff9]::ops::function::FnOnce<(rustc_middle[323d677696c3953f]::ty::context::TyCtxt, rustc_middle[323d677696c3953f]::ty::PseudoCanonicalInput<rustc_middle[323d677696c3953f]::mir::interpret::GlobalId>)>>::call_once
19: 0x793d992e9380 - rustc_query_impl[bf9f47c0be6c5cea]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf9f47c0be6c5cea]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 16usize]>>
20: 0x793d992e933b - <rustc_query_impl[bf9f47c0be6c5cea]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[61603b96a07b8ff9]::ops::function::FnOnce<(rustc_middle[323d677696c3953f]::ty::context::TyCtxt, rustc_middle[323d677696c3953f]::ty::PseudoCanonicalInput<rustc_middle[323d677696c3953f]::mir::interpret::GlobalId>)>>::call_once
21: 0x793d99a6da86 - rustc_query_system[c53c5369b4d54c12]::query::plumbing::try_execute_query::<rustc_query_impl[bf9f47c0be6c5cea]::DynamicConfig<rustc_query_system[c53c5369b4d54c12]::query::caches::DefaultCache<rustc_middle[323d677696c3953f]::ty::PseudoCanonicalInput<rustc_middle[323d677696c3953f]::mir::interpret::GlobalId>, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bf9f47c0be6c5cea]::plumbing::QueryCtxt, false>
22: 0x793d99a6d6b0 - rustc_query_impl[bf9f47c0be6c5cea]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
23: 0x793d95bede05 - <rustc_middle[323d677696c3953f]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
24: 0x793d9909e696 - rustc_trait_selection[757bd25c1da00447]::traits::try_evaluate_const
25: 0x793d99c8767e - <rustc_next_trait_solver[d3189b9d374fc12e]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[757bd25c1da00447]::solve::delegate::SolverDelegate> as rustc_type_ir[1c38f7d4a599027a]::search_graph::Delegate>::compute_goal::{closure#0}
26: 0x793d9999b763 - <rustc_next_trait_solver[d3189b9d374fc12e]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[757bd25c1da00447]::solve::delegate::SolverDelegate, rustc_middle[323d677696c3953f]::ty::context::TyCtxt>>::evaluate_goal_raw
27: 0x793d999a62a5 - <rustc_next_trait_solver[d3189b9d374fc12e]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[757bd25c1da00447]::solve::delegate::SolverDelegate, rustc_middle[323d677696c3953f]::ty::context::TyCtxt>>::try_evaluate_added_goals
28: 0x793d99c86fbe - <rustc_next_trait_solver[d3189b9d374fc12e]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[757bd25c1da00447]::solve::delegate::SolverDelegate> as rustc_type_ir[1c38f7d4a599027a]::search_graph::Delegate>::compute_goal::{closure#0}
29: 0x793d9999b763 - <rustc_next_trait_solver[d3189b9d374fc12e]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[757bd25c1da00447]::solve::delegate::SolverDelegate, rustc_middle[323d677696c3953f]::ty::context::TyCtxt>>::evaluate_goal_raw
30: 0x793d99998421 - rustc_trait_selection[757bd25c1da00447]::traits::coherence::overlap
31: 0x793d95d85770 - <rustc_middle[323d677696c3953f]::traits::specialization_graph::Children as rustc_trait_selection[757bd25c1da00447]::traits::specialize::specialization_graph::ChildrenExt>::insert
32: 0x793d98e962f8 - <rustc_middle[323d677696c3953f]::traits::specialization_graph::Graph as rustc_trait_selection[757bd25c1da00447]::traits::specialize::specialization_graph::GraphExt>::insert
33: 0x793d98e97757 - rustc_trait_selection[757bd25c1da00447]::traits::specialize::specialization_graph_provider
34: 0x793d98e9718d - rustc_query_impl[bf9f47c0be6c5cea]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf9f47c0be6c5cea]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 8usize]>>
35: 0x793d98e11985 - rustc_query_system[c53c5369b4d54c12]::query::plumbing::try_execute_query::<rustc_query_impl[bf9f47c0be6c5cea]::DynamicConfig<rustc_query_system[c53c5369b4d54c12]::query::caches::DefIdCache<rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bf9f47c0be6c5cea]::plumbing::QueryCtxt, false>
36: 0x793d99092edb - rustc_query_impl[bf9f47c0be6c5cea]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
37: 0x793d99096108 - rustc_hir_analysis[ae5f01f7b13d6b97]::coherence::coherent_trait
38: 0x793d99095e13 - rustc_query_impl[bf9f47c0be6c5cea]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf9f47c0be6c5cea]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 1usize]>>
39: 0x793d993b8420 - rustc_query_system[c53c5369b4d54c12]::query::plumbing::try_execute_query::<rustc_query_impl[bf9f47c0be6c5cea]::DynamicConfig<rustc_query_system[c53c5369b4d54c12]::query::caches::DefIdCache<rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf9f47c0be6c5cea]::plumbing::QueryCtxt, false>
40: 0x793d993b74e4 - rustc_query_impl[bf9f47c0be6c5cea]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
41: 0x793d995fb587 - rustc_hir_analysis[ae5f01f7b13d6b97]::check::check::check_item_type
42: 0x793d995f691c - rustc_hir_analysis[ae5f01f7b13d6b97]::check::wfcheck::check_well_formed
43: 0x793d995f68eb - rustc_query_impl[bf9f47c0be6c5cea]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf9f47c0be6c5cea]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 1usize]>>
44: 0x793d995f6363 - rustc_query_system[c53c5369b4d54c12]::query::plumbing::try_execute_query::<rustc_query_impl[bf9f47c0be6c5cea]::DynamicConfig<rustc_data_structures[169de96c3a3bf2b5]::vec_cache::VecCache<rustc_span[ddbbc3270fa539b]::def_id::LocalDefId, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[c53c5369b4d54c12]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[bf9f47c0be6c5cea]::plumbing::QueryCtxt, false>
45: 0x793d995f5e56 - rustc_query_impl[bf9f47c0be6c5cea]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
46: 0x793d995f35f0 - rustc_hir_analysis[ae5f01f7b13d6b97]::check::wfcheck::check_type_wf
47: 0x793d995f34f9 - rustc_query_impl[bf9f47c0be6c5cea]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf9f47c0be6c5cea]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 1usize]>>
48: 0x793d99f6de45 - rustc_query_system[c53c5369b4d54c12]::query::plumbing::try_execute_query::<rustc_query_impl[bf9f47c0be6c5cea]::DynamicConfig<rustc_query_system[c53c5369b4d54c12]::query::caches::SingleCache<rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf9f47c0be6c5cea]::plumbing::QueryCtxt, false>
49: 0x793d99f6daf6 - rustc_query_impl[bf9f47c0be6c5cea]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
50: 0x793d99a5b074 - rustc_hir_analysis[ae5f01f7b13d6b97]::check_crate
51: 0x793d98f8121b - rustc_interface[64e9028641784d78]::passes::analysis
52: 0x793d98f80e65 - rustc_query_impl[bf9f47c0be6c5cea]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf9f47c0be6c5cea]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 0usize]>>
53: 0x793d99f6f751 - rustc_query_system[c53c5369b4d54c12]::query::plumbing::try_execute_query::<rustc_query_impl[bf9f47c0be6c5cea]::DynamicConfig<rustc_query_system[c53c5369b4d54c12]::query::caches::SingleCache<rustc_middle[323d677696c3953f]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[bf9f47c0be6c5cea]::plumbing::QueryCtxt, false>
54: 0x793d99f6f53c - rustc_query_impl[bf9f47c0be6c5cea]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
55: 0x793d9a1554d4 - <rustc_interface[64e9028641784d78]::passes::create_and_enter_global_ctxt<core[61603b96a07b8ff9]::option::Option<rustc_interface[64e9028641784d78]::queries::Linker>, rustc_driver_impl[5f67874deb35e28a]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[61603b96a07b8ff9]::ops::function::FnOnce<(&rustc_session[80cc42b19f2be7ae]::session::Session, rustc_middle[323d677696c3953f]::ty::context::CurrentGcx, alloc[cd9c1527bed1fc96]::sync::Arc<rustc_data_structures[169de96c3a3bf2b5]::jobserver::Proxy>, &std[f475c8dea6bc1f1c]::sync::once_lock::OnceLock<rustc_middle[323d677696c3953f]::ty::context::GlobalCtxt>, &rustc_data_structures[169de96c3a3bf2b5]::sync::worker_local::WorkerLocal<rustc_middle[323d677696c3953f]::arena::Arena>, &rustc_data_structures[169de96c3a3bf2b5]::sync::worker_local::WorkerLocal<rustc_hir[efbd91fb3c2f0b84]::Arena>, rustc_driver_impl[5f67874deb35e28a]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
56: 0x793d99f8350f - rustc_interface[64e9028641784d78]::interface::run_compiler::<(), rustc_driver_impl[5f67874deb35e28a]::run_compiler::{closure#0}>::{closure#1}
57: 0x793d99fe16be - std[f475c8dea6bc1f1c]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[64e9028641784d78]::util::run_in_thread_with_globals<rustc_interface[64e9028641784d78]::util::run_in_thread_pool_with_globals<rustc_interface[64e9028641784d78]::interface::run_compiler<(), rustc_driver_impl[5f67874deb35e28a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
58: 0x793d99fe1be0 - <std[f475c8dea6bc1f1c]::thread::lifecycle::spawn_unchecked<rustc_interface[64e9028641784d78]::util::run_in_thread_with_globals<rustc_interface[64e9028641784d78]::util::run_in_thread_pool_with_globals<rustc_interface[64e9028641784d78]::interface::run_compiler<(), rustc_driver_impl[5f67874deb35e28a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[61603b96a07b8ff9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
59: 0x793d99fe2a6c - <std[f475c8dea6bc1f1c]::sys::thread::unix::Thread>::new::thread_start
60: 0x793d93894ac3 - <unknown>
61: 0x793d939268c0 - <unknown>
62: 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 `/app/rustc-ice-2026-01-24T14_19_56-1.txt` to your bug report
note: rustc 1.95.0-nightly (d222ddc4d 2026-01-23) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 --crate-type bin -C linker=/opt/compiler-explorer/gcc-15.2.0/bin/gcc
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at <source>:57:1: 57:33>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
#2 [specialization_graph_of] building specialization graph of trait `core::marker::Copy`
#3 [coherent_trait] coherence checking all impls of trait `core::marker::Copy`
#4 [check_well_formed] checking that `<impl at <source>:57:1: 57:33>` is well-formed
#5 [check_type_wf] checking that types are well-formed
#6 [analysis] running analysis passes on crate `example`
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.
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.