[ICE]: `Got a scalar pair where a scalar was expected`
Open
@GokhanKabar is already working on this.
Since Apr 13, 2026.
C-bug
I-ICE
P-low
regression-from-stable-to-nightly
T-compiler
WG-trait-system-refactor
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
auto-reduced (treereduce-rust):
//@compile-flags: -Znext-solver=globally
impl<'a, T: ?Sized> Sized for T {}
fn main() {
const {
unsafe {
let value = [1, 2];
let ptr = value.as_ptr().add(2);
}
}
}
original:
#![feature(min_specialization)]
trait MySpecTrait {
fn f();
}
impl<'a, T: ?Sized> Sized for T {
default fn f() {}
}
impl<T> MySpecTrait for &'a T {
fn f() {}
}
fn main() {
const {
unsafe {
let value = [1, 2];
let ptr = value.as_ptr().add(2);
let fat = std::ptr::slice_from_raw_parts(ptr, usize::MAX);
let _ice = (*fat)[ + 0 + 1 + 1
+ 1 + 1];
}
}
}
Version information
rustc 1.97.0-nightly (dab8d9d10 2026-04-12)
binary: rustc
commit-hash: dab8d9d1066c4c95008163c7babf275106ce3f32
commit-date: 2026-04-12
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.2
Possibly related line of code:
https://github.com/rust-lang/rust/blob/dab8d9d1066c4c95008163c7babf275106ce3f32/compiler/rustc_const_eval/src/interpret/operand.rs#L81-L93
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=globally
Program output
error[E0322]: explicit impls for the `Sized` trait are not permitted
--> /tmp/icemaker_global_tempdir.ijetyTEoRrg7/rustc_testrunner_tmpdir_reporting.vqmJqRh8PV63/mvce.rs:1:1
|
1 | impl<'a, T: ?Sized> Sized for T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> /tmp/icemaker_global_tempdir.ijetyTEoRrg7/rustc_testrunner_tmpdir_reporting.vqmJqRh8PV63/mvce.rs:1:10
|
1 | impl<'a, T: ?Sized> Sized for T {}
| ^ type parameter `T` must be used as the type parameter for some local type
|
= note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local
= note: only traits defined in the current crate can be implemented for a type parameter
warning: unused variable: `ptr`
--> /tmp/icemaker_global_tempdir.ijetyTEoRrg7/rustc_testrunner_tmpdir_reporting.vqmJqRh8PV63/mvce.rs:7:17
|
7 | let ptr = value.as_ptr().add(2);
| ^^^ help: if this is intentional, prefix it with an underscore: `_ptr`
|
= note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
error: internal compiler error: /rustc-dev/dab8d9d1066c4c95008163c7babf275106ce3f32/compiler/rustc_const_eval/src/interpret/operand.rs:87:42: Got a scalar pair where a scalar was expected
thread 'rustc' (36528) panicked at /rustc-dev/dab8d9d1066c4c95008163c7babf275106ce3f32/compiler/rustc_const_eval/src/interpret/operand.rs:87:42:
Box<dyn Any>
stack backtrace:
0: 0x7f617c62f00b - <<std[8da0d64ac8131bdc]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f9890b7f281801e7]::fmt::Display>::fmt
1: 0x7f617cc20ac8 - core[f9890b7f281801e7]::fmt::write
2: 0x7f617c6462d6 - <std[8da0d64ac8131bdc]::sys::stdio::unix::Stderr as std[8da0d64ac8131bdc]::io::Write>::write_fmt
3: 0x7f617c605308 - std[8da0d64ac8131bdc]::panicking::default_hook::{closure#0}
4: 0x7f617c622673 - std[8da0d64ac8131bdc]::panicking::default_hook
5: 0x7f617b5fea1c - std[8da0d64ac8131bdc]::panicking::update_hook::<alloc[d917484f94c95b6d]::boxed::Box<rustc_driver_impl[b2ed678f474368d]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f617c622952 - std[8da0d64ac8131bdc]::panicking::panic_with_hook
7: 0x7f617b62e901 - std[8da0d64ac8131bdc]::panicking::begin_panic::<rustc_errors[da4fca7d51b28372]::ExplicitBug>::{closure#0}
8: 0x7f617b627366 - std[8da0d64ac8131bdc]::sys::backtrace::__rust_end_short_backtrace::<std[8da0d64ac8131bdc]::panicking::begin_panic<rustc_errors[da4fca7d51b28372]::ExplicitBug>::{closure#0}, !>
9: 0x7f617b625278 - std[8da0d64ac8131bdc]::panicking::begin_panic::<rustc_errors[da4fca7d51b28372]::ExplicitBug>
10: 0x7f617b639e51 - <rustc_errors[da4fca7d51b28372]::diagnostic::BugAbort as rustc_errors[da4fca7d51b28372]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7f617bc336d9 - rustc_middle[854472fbb2a70fbb]::util::bug::opt_span_bug_fmt::<rustc_span[3bf58ae8b6d8fa24]::span_encoding::Span>::{closure#0}
12: 0x7f617bc33862 - rustc_middle[854472fbb2a70fbb]::ty::context::tls::with_opt::<rustc_middle[854472fbb2a70fbb]::util::bug::opt_span_bug_fmt<rustc_span[3bf58ae8b6d8fa24]::span_encoding::Span>::{closure#0}, !>::{closure#0}
13: 0x7f617bc2400b - rustc_middle[854472fbb2a70fbb]::ty::context::tls::with_context_opt::<rustc_middle[854472fbb2a70fbb]::ty::context::tls::with_opt<rustc_middle[854472fbb2a70fbb]::util::bug::opt_span_bug_fmt<rustc_span[3bf58ae8b6d8fa24]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
14: 0x7f6178d35ce4 - rustc_middle[854472fbb2a70fbb]::util::bug::bug_fmt
15: 0x7f617e10d3e0 - <rustc_const_eval[aec75a2448d811d3]::interpret::eval_context::InterpCx<rustc_const_eval[aec75a2448d811d3]::const_eval::machine::CompileTimeMachine>>::binary_op
16: 0x7f617a4e3af3 - <rustc_const_eval[aec75a2448d811d3]::interpret::eval_context::InterpCx<rustc_const_eval[aec75a2448d811d3]::const_eval::machine::CompileTimeMachine>>::eval_rvalue_into_place
17: 0x7f617a4dc0e1 - rustc_const_eval[aec75a2448d811d3]::const_eval::eval_queries::eval_to_allocation_raw_provider
18: 0x7f617d40cc16 - rustc_query_impl[e8c0d15e0ce1a66c]::query_impl::eval_to_allocation_raw::invoke_provider_fn::__rust_begin_short_backtrace
19: 0x7f617d40c2c3 - rustc_query_impl[e8c0d15e0ce1a66c]::execution::try_execute_query::<rustc_middle[854472fbb2a70fbb]::query::caches::DefaultCache<rustc_middle[854472fbb2a70fbb]::ty::PseudoCanonicalInput<rustc_middle[854472fbb2a70fbb]::mir::interpret::GlobalId>, rustc_middle[854472fbb2a70fbb]::query::erase::ErasedData<[u8; 24usize]>>, false>
20: 0x7f617d40bcc7 - rustc_query_impl[e8c0d15e0ce1a66c]::query_impl::eval_to_allocation_raw::execute_query_non_incr::__rust_end_short_backtrace
21: 0x7f617d40ab40 - rustc_const_eval[aec75a2448d811d3]::const_eval::eval_queries::eval_to_const_value_raw_provider
22: 0x7f617d40a696 - rustc_query_impl[e8c0d15e0ce1a66c]::query_impl::eval_to_const_value_raw::invoke_provider_fn::__rust_begin_short_backtrace
23: 0x7f617d40c1bb - rustc_query_impl[e8c0d15e0ce1a66c]::execution::try_execute_query::<rustc_middle[854472fbb2a70fbb]::query::caches::DefaultCache<rustc_middle[854472fbb2a70fbb]::ty::PseudoCanonicalInput<rustc_middle[854472fbb2a70fbb]::mir::interpret::GlobalId>, rustc_middle[854472fbb2a70fbb]::query::erase::ErasedData<[u8; 24usize]>>, false>
24: 0x7f617d40bd7f - rustc_query_impl[e8c0d15e0ce1a66c]::query_impl::eval_to_const_value_raw::execute_query_non_incr::__rust_end_short_backtrace
25: 0x7f617d73689f - <rustc_middle[854472fbb2a70fbb]::ty::context::TyCtxt>::const_eval_resolve
26: 0x7f617d64b5b1 - <rustc_mir_transform[529351ae2b1b511b]::known_panics_lint::ConstPropagator as rustc_middle[854472fbb2a70fbb]::mir::visit::Visitor>::visit_assign
27: 0x7f617d6474fd - <rustc_mir_transform[529351ae2b1b511b]::known_panics_lint::ConstPropagator as rustc_middle[854472fbb2a70fbb]::mir::visit::Visitor>::visit_body
28: 0x7f617d641c4d - <rustc_mir_transform[529351ae2b1b511b]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[529351ae2b1b511b]::pass_manager::MirLint>::run_lint
29: 0x7f617cc0d13c - rustc_mir_transform[529351ae2b1b511b]::run_analysis_to_runtime_passes
30: 0x7f617d842ab7 - rustc_mir_transform[529351ae2b1b511b]::mir_drops_elaborated_and_const_checked
31: 0x7f617d842559 - rustc_query_impl[e8c0d15e0ce1a66c]::query_impl::mir_drops_elaborated_and_const_checked::invoke_provider_fn::__rust_begin_short_backtrace
32: 0x7f617cf12c26 - rustc_query_impl[e8c0d15e0ce1a66c]::execution::try_execute_query::<rustc_data_structures[eff972d194685d0b]::vec_cache::VecCache<rustc_span[3bf58ae8b6d8fa24]::def_id::LocalDefId, rustc_middle[854472fbb2a70fbb]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[854472fbb2a70fbb]::dep_graph::graph::DepNodeIndex>, false>
33: 0x7f617cf1369b - rustc_query_impl[e8c0d15e0ce1a66c]::query_impl::mir_drops_elaborated_and_const_checked::execute_query_non_incr::__rust_end_short_backtrace
34: 0x7f617db123dc - <rustc_middle[854472fbb2a70fbb]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[8e9c025ebfbd6215]::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
35: 0x7f617db1169d - rustc_interface[8e9c025ebfbd6215]::passes::analysis
36: 0x7f617ddc7d09 - rustc_query_impl[e8c0d15e0ce1a66c]::execution::try_execute_query::<rustc_middle[854472fbb2a70fbb]::query::caches::SingleCache<rustc_middle[854472fbb2a70fbb]::query::erase::ErasedData<[u8; 0usize]>>, false>
37: 0x7f617ddc7969 - rustc_query_impl[e8c0d15e0ce1a66c]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
38: 0x7f617dd9f610 - rustc_interface[8e9c025ebfbd6215]::interface::run_compiler::<(), rustc_driver_impl[b2ed678f474368d]::run_compiler::{closure#0}>::{closure#1}
39: 0x7f617dd8c77e - std[8da0d64ac8131bdc]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8e9c025ebfbd6215]::util::run_in_thread_with_globals<rustc_interface[8e9c025ebfbd6215]::util::run_in_thread_pool_with_globals<rustc_interface[8e9c025ebfbd6215]::interface::run_compiler<(), rustc_driver_impl[b2ed678f474368d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
40: 0x7f617dd8d020 - <std[8da0d64ac8131bdc]::thread::lifecycle::spawn_unchecked<rustc_interface[8e9c025ebfbd6215]::util::run_in_thread_with_globals<rustc_interface[8e9c025ebfbd6215]::util::run_in_thread_pool_with_globals<rustc_interface[8e9c025ebfbd6215]::interface::run_compiler<(), rustc_driver_impl[b2ed678f474368d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f9890b7f281801e7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
41: 0x7f617dd8deac - <std[8da0d64ac8131bdc]::sys::thread::unix::Thread>::new::thread_start
42: 0x7f61778a597a - <unknown>
43: 0x7f61779292bc - <unknown>
44: 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: rustc 1.97.0-nightly (dab8d9d10 2026-04-12) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z next-solver=globally -Z dump-mir-dir=dir
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
#1 [eval_to_const_value_raw] simplifying constant for the type system `main::{constant#0}`
#2 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`
#3 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted
Some errors have detailed explanations: E0210, E0322.
For more information about an error, try `rustc --explain E0210`.
@rustbot label +F-min_specialization +WG-trait-system-refactor
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.