[ICE]: Operand evaluation failure during slice pattern matching with Sized constraint
Open
@cjgillot is already working on this.
Since Jul 20, 2026.
A-const-eval
A-impossible-bounds
A-patterns
C-bug
I-ICE
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
const FOO: &[u8] = b"foo";
const BAR: &[u8] = &[1, 2, 3];
const BOO: &i32 = &42;
fn main()
where
[u8]: Sized,
{
match &[1u8, 2, 3] as &[u8] {
FOO => panic!("a"),
BAR => println!("b"),
_ => panic!("c"),
}
}
Meta
rustc --version --verbose:
rustc 1.91.0-nightly (7aef4bec4 2025-09-01)
binary: rustc
commit-hash: 7aef4bec4bec16cb6204d51eb633873e23b18771
commit-date: 2025-09-01
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
Error output
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> ablation_test_390.rs:6:5
|
6 | [u8]: Sized,
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
1 + #![feature(trivial_bounds)]
|
error[E0646]: `main` function is not allowed to have a `where` clause
--> ablation_test_390.rs:5:1
|
5 | / where
6 | | [u8]: Sized,
| |________________^ `main` cannot have a `where` clause
error: internal compiler error: compiler/rustc_const_eval/src/interpret/operand.rs:160:17: invalid immediate for given destination place: value ScalarPair(alloc1<imm>, 0x0000000000000003) does not match ABI Scalar(Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }))
thread 'rustc' (2666689) panicked at compiler/rustc_const_eval/src/interpret/operand.rs:160:17:
Box<dyn Any>
stack backtrace:
0: 0x7efd24d9b3f3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::haa9e21b9f7728e9d
1: 0x7efd25401a58 - core::fmt::write::h47c537b314f2b42f
2: 0x7efd24d50281 - std::io::Write::write_fmt::h5da305e456c839dd
3: 0x7efd24d612d2 - std::sys::backtrace::BacktraceLock::print::hcf670bc61597714e
4: 0x7efd24d67259 - std::panicking::default_hook::{{closure}}::hd30aa8fb7428f34c
5: 0x7efd24d66d83 - std::panicking::default_hook::h6f511f2c07c5c455
6: 0x7efd23dc8ee5 - std[5da760f60d7714ca]::panicking::update_hook::<alloc[1522900af3ecc125]::boxed::Box<rustc_driver_impl[16ac858b76c31f9c]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7efd24d6770e - std::panicking::panic_with_hook::heb0ec0de58fd0d2e
8: 0x7efd23e058c1 - std[5da760f60d7714ca]::panicking::begin_panic::<rustc_errors[ec897967084f5882]::ExplicitBug>::{closure#0}
9: 0x7efd23df9146 - std[5da760f60d7714ca]::sys::backtrace::__rust_end_short_backtrace::<std[5da760f60d7714ca]::panicking::begin_panic<rustc_errors[ec897967084f5882]::ExplicitBug>::{closure#0}, !>
10: 0x7efd23df6e4b - std[5da760f60d7714ca]::panicking::begin_panic::<rustc_errors[ec897967084f5882]::ExplicitBug>
11: 0x7efd23e10fd1 - <rustc_errors[ec897967084f5882]::diagnostic::BugAbort as rustc_errors[ec897967084f5882]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7efd243a6e1a - rustc_middle[7207d213a2a562b6]::util::bug::opt_span_bug_fmt::<rustc_span[7570dc1d93289a01]::span_encoding::Span>::{closure#0}
13: 0x7efd243a6e7a - rustc_middle[7207d213a2a562b6]::ty::context::tls::with_opt::<rustc_middle[7207d213a2a562b6]::util::bug::opt_span_bug_fmt<rustc_span[7570dc1d93289a01]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7efd243955cb - rustc_middle[7207d213a2a562b6]::ty::context::tls::with_context_opt::<rustc_middle[7207d213a2a562b6]::ty::context::tls::with_opt<rustc_middle[7207d213a2a562b6]::util::bug::opt_span_bug_fmt<rustc_span[7570dc1d93289a01]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x7efd214c8690 - rustc_middle[7207d213a2a562b6]::util::bug::bug_fmt
16: 0x7efd2566af17 - <rustc_const_eval[ddd0185d600a9d90]::interpret::eval_context::InterpCx<rustc_const_eval[ddd0185d600a9d90]::const_eval::machine::CompileTimeMachine>>::write_immediate_no_validate::<rustc_const_eval[ddd0185d600a9d90]::interpret::place::PlaceTy>
17: 0x7efd2563cdf9 - <rustc_const_eval[ddd0185d600a9d90]::interpret::eval_context::InterpCx<rustc_const_eval[ddd0185d600a9d90]::const_eval::machine::CompileTimeMachine>>::return_from_current_stack_frame
18: 0x7efd25641f46 - rustc_const_eval[ddd0185d600a9d90]::const_eval::eval_queries::eval_to_allocation_raw_provider
19: 0x7efd25641140 - rustc_query_impl[684ab2f7647ada3b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[684ab2f7647ada3b]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 24usize]>>
20: 0x7efd256280a5 - rustc_query_system[d8ada103bf964d49]::query::plumbing::try_execute_query::<rustc_query_impl[684ab2f7647ada3b]::DynamicConfig<rustc_query_system[d8ada103bf964d49]::query::caches::DefaultCache<rustc_middle[7207d213a2a562b6]::ty::PseudoCanonicalInput<rustc_middle[7207d213a2a562b6]::mir::interpret::GlobalId>, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[684ab2f7647ada3b]::plumbing::QueryCtxt, false>
21: 0x7efd25627c3d - rustc_query_impl[684ab2f7647ada3b]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
22: 0x7efd256274a2 - rustc_const_eval[ddd0185d600a9d90]::const_eval::valtrees::eval_to_valtree
23: 0x7efd2562724f - rustc_query_impl[684ab2f7647ada3b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[684ab2f7647ada3b]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 16usize]>>
24: 0x7efd259f45c5 - rustc_query_system[d8ada103bf964d49]::query::plumbing::try_execute_query::<rustc_query_impl[684ab2f7647ada3b]::DynamicConfig<rustc_query_system[d8ada103bf964d49]::query::caches::DefaultCache<rustc_middle[7207d213a2a562b6]::ty::PseudoCanonicalInput<rustc_middle[7207d213a2a562b6]::mir::interpret::GlobalId>, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[684ab2f7647ada3b]::plumbing::QueryCtxt, false>
25: 0x7efd259f4170 - rustc_query_impl[684ab2f7647ada3b]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
26: 0x7efd259f3181 - <rustc_middle[7207d213a2a562b6]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
27: 0x7efd25e1337a - <rustc_mir_build[3c34d9aa2ff8ae5e]::thir::pattern::PatCtxt>::const_to_pat
28: 0x7efd25e227a8 - <rustc_mir_build[3c34d9aa2ff8ae5e]::thir::pattern::PatCtxt>::lower_pat_expr
29: 0x7efd25e24ba1 - <rustc_mir_build[3c34d9aa2ff8ae5e]::thir::pattern::PatCtxt>::lower_pattern
30: 0x7efd25e23495 - <rustc_mir_build[3c34d9aa2ff8ae5e]::thir::cx::ThirBuildCx>::pattern_from_hir
31: 0x7efd25e2cb01 - <rustc_mir_build[3c34d9aa2ff8ae5e]::thir::cx::ThirBuildCx>::mirror_expr
32: 0x7efd25e2c57a - <rustc_mir_build[3c34d9aa2ff8ae5e]::thir::cx::ThirBuildCx>::mirror_expr
33: 0x7efd25e1ea7c - rustc_mir_build[3c34d9aa2ff8ae5e]::thir::cx::thir_body
34: 0x7efd25e1dce0 - rustc_query_impl[684ab2f7647ada3b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[684ab2f7647ada3b]::query_impl::thir_body::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 16usize]>>
35: 0x7efd25cac696 - rustc_query_system[d8ada103bf964d49]::query::plumbing::try_execute_query::<rustc_query_impl[684ab2f7647ada3b]::DynamicConfig<rustc_data_structures[e7e58a7a00c6a16f]::vec_cache::VecCache<rustc_span[7570dc1d93289a01]::def_id::LocalDefId, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 16usize]>, rustc_query_system[d8ada103bf964d49]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[684ab2f7647ada3b]::plumbing::QueryCtxt, false>
36: 0x7efd25cac2cc - rustc_query_impl[684ab2f7647ada3b]::query_impl::thir_body::get_query_non_incr::__rust_end_short_backtrace
37: 0x7efd26230e37 - rustc_mir_build[3c34d9aa2ff8ae5e]::check_unsafety::check_unsafety
38: 0x7efd26230c19 - rustc_query_impl[684ab2f7647ada3b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[684ab2f7647ada3b]::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 0usize]>>
39: 0x7efd255e3519 - rustc_query_system[d8ada103bf964d49]::query::plumbing::try_execute_query::<rustc_query_impl[684ab2f7647ada3b]::DynamicConfig<rustc_data_structures[e7e58a7a00c6a16f]::vec_cache::VecCache<rustc_span[7570dc1d93289a01]::def_id::LocalDefId, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 0usize]>, rustc_query_system[d8ada103bf964d49]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[684ab2f7647ada3b]::plumbing::QueryCtxt, false>
40: 0x7efd255e313d - rustc_query_impl[684ab2f7647ada3b]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
41: 0x7efd255e25b9 - <rustc_middle[7207d213a2a562b6]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[c500fa999646e344]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
42: 0x7efd255dfe99 - rustc_interface[c500fa999646e344]::passes::analysis
43: 0x7efd255df34b - rustc_query_impl[684ab2f7647ada3b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[684ab2f7647ada3b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 0usize]>>
44: 0x7efd263b97d4 - rustc_query_system[d8ada103bf964d49]::query::plumbing::try_execute_query::<rustc_query_impl[684ab2f7647ada3b]::DynamicConfig<rustc_query_system[d8ada103bf964d49]::query::caches::SingleCache<rustc_middle[7207d213a2a562b6]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[684ab2f7647ada3b]::plumbing::QueryCtxt, false>
45: 0x7efd263b940c - rustc_query_impl[684ab2f7647ada3b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
46: 0x7efd266816e4 - rustc_interface[c500fa999646e344]::passes::create_and_enter_global_ctxt::<core[7ac50f046ab9c0d]::option::Option<rustc_interface[c500fa999646e344]::queries::Linker>, rustc_driver_impl[16ac858b76c31f9c]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
47: 0x7efd266724e2 - rustc_interface[c500fa999646e344]::interface::run_compiler::<(), rustc_driver_impl[16ac858b76c31f9c]::run_compiler::{closure#0}>::{closure#1}
48: 0x7efd264facf8 - std[5da760f60d7714ca]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c500fa999646e344]::util::run_in_thread_with_globals<rustc_interface[c500fa999646e344]::util::run_in_thread_pool_with_globals<rustc_interface[c500fa999646e344]::interface::run_compiler<(), rustc_driver_impl[16ac858b76c31f9c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
49: 0x7efd264fa9dc - <<std[5da760f60d7714ca]::thread::Builder>::spawn_unchecked_<rustc_interface[c500fa999646e344]::util::run_in_thread_with_globals<rustc_interface[c500fa999646e344]::util::run_in_thread_pool_with_globals<rustc_interface[c500fa999646e344]::interface::run_compiler<(), rustc_driver_impl[16ac858b76c31f9c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[7ac50f046ab9c0d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
50: 0x7efd265008cd - std::sys::pal::unix::thread::Thread::new::thread_start::h427fd483c5aaf6bf
51: 0x7efd2006cac3 - start_thread
at ./nptl/pthread_create.c:442:8
52: 0x7efd200fea40 - __clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0
53: 0x0 - <unknown>
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 `/home/gldong/project/AxiomAgent/experiment_results/rust_extracts_valid/compile_error/rule_390/error_logs/ice_files/rustc-ice-2026-02-25T05_39_25-2666671.txt` to your bug report
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `FOO`
#1 [eval_to_valtree] evaluating type-level constant
... and 3 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0277, E0646.
For more information about an error, try `rustc --explain E0277`.
Backtrace
<backtrace>
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.