Skip to content

ICE: Got a scalar pair where a scalar was expected #117806

Closed
@matthiaskrgr

Description

code:

const C: *const str = "abcd";

fn main() {
    match C {
        C => {}
        _ => {}
    }
}

Version information

rustc 1.75.0-nightly (d4c86cfc4 2023-11-10)
binary: rustc
commit-hash: d4c86cfc4984293d642e5b4f7eece60a6e83e264
commit-date: 2023-11-10
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: internal compiler error: compiler/rustc_const_eval/src/interpret/operand.rs:82:42: Got a scalar pair where a scalar was expected

thread 'rustc' panicked at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/compiler/rustc_errors/src/lib.rs:1661:9:
Box<dyn Any>
stack backtrace:
   0:     0x7fc50ab8b62c - std::backtrace_rs::backtrace::libunwind::trace::h7403dcdac4d19faa
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fc50ab8b62c - std::backtrace_rs::backtrace::trace_unsynchronized::hdd62beea6bae6bae
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc50ab8b62c - std::sys_common::backtrace::_print_fmt::h3f14eb4919955918
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fc50ab8b62c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb58cdbef1b962a06
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fc50abde630 - core::fmt::rt::Argument::fmt::h86981bcf87d4a7f0
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/core/src/fmt/rt.rs:142:9
   5:     0x7fc50abde630 - core::fmt::write::ha16fbdecd9d29982
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fc50ab7f4bf - std::io::Write::write_fmt::hc5db0459081cf177
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/io/mod.rs:1762:15
   7:     0x7fc50ab8b414 - std::sys_common::backtrace::_print::hc120e3a003300f29
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fc50ab8b414 - std::sys_common::backtrace::print::hab3217e4f5b0a2ac
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fc50ab8e0a7 - std::panicking::default_hook::{{closure}}::hc288cfa04774c9a7
  10:     0x7fc50ab8de0f - std::panicking::default_hook::hb4dd9100feb3266d
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/panicking.rs:292:9
  11:     0x7fc50d8ee010 - std[26242507ebbaff5e]::panicking::update_hook::<alloc[226c52a82ae72531]::boxed::Box<rustc_driver_impl[4f97d39af0eb4c73]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fc50ab8e7e8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h377bfc9636b87745
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/alloc/src/boxed.rs:2021:9
  13:     0x7fc50ab8e7e8 - std::panicking::rust_panic_with_hook::hac1bb62a4154ba3f
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/panicking.rs:783:13
  14:     0x7fc50dd3a144 - std[26242507ebbaff5e]::panicking::begin_panic::<rustc_errors[f386932004fe6303]::ExplicitBug>::{closure#0}
  15:     0x7fc50dd2e076 - std[26242507ebbaff5e]::sys_common::backtrace::__rust_end_short_backtrace::<std[26242507ebbaff5e]::panicking::begin_panic<rustc_errors[f386932004fe6303]::ExplicitBug>::{closure#0}, !>
  16:     0x7fc50dd1c8c6 - std[26242507ebbaff5e]::panicking::begin_panic::<rustc_errors[f386932004fe6303]::ExplicitBug>
  17:     0x7fc50dd136a4 - <rustc_errors[f386932004fe6303]::HandlerInner>::bug::<alloc[226c52a82ae72531]::string::String>
  18:     0x7fc50dd133aa - <rustc_errors[f386932004fe6303]::Handler>::bug::<alloc[226c52a82ae72531]::string::String>
  19:     0x7fc50ddb514d - rustc_middle[8f79015ccec99cc5]::util::bug::opt_span_bug_fmt::<rustc_span[b9ecb8faaa45969b]::span_encoding::Span>::{closure#0}
  20:     0x7fc50dd9c75a - rustc_middle[8f79015ccec99cc5]::ty::context::tls::with_opt::<rustc_middle[8f79015ccec99cc5]::util::bug::opt_span_bug_fmt<rustc_span[b9ecb8faaa45969b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fc50dd9c5f8 - rustc_middle[8f79015ccec99cc5]::ty::context::tls::with_context_opt::<rustc_middle[8f79015ccec99cc5]::ty::context::tls::with_opt<rustc_middle[8f79015ccec99cc5]::util::bug::opt_span_bug_fmt<rustc_span[b9ecb8faaa45969b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fc50bd16e10 - rustc_middle[8f79015ccec99cc5]::util::bug::bug_fmt
  23:     0x7fc50d8a406f - <rustc_const_eval[9b83ff6fc5aa92d8]::interpret::eval_context::InterpCx<rustc_const_eval[9b83ff6fc5aa92d8]::const_eval::machine::CompileTimeInterpreter>>::read_scalar::<rustc_const_eval[9b83ff6fc5aa92d8]::interpret::place::MPlaceTy>
  24:     0x7fc50f6d70ed - rustc_const_eval[9b83ff6fc5aa92d8]::const_eval::valtrees::const_to_valtree_inner
  25:     0x7fc50f3ca634 - rustc_const_eval[9b83ff6fc5aa92d8]::const_eval::eval_to_valtree
  26:     0x7fc50f3ca222 - <rustc_const_eval[9b83ff6fc5aa92d8]::provide::{closure#0} as core[e8a0262c3f78457e]::ops::function::FnOnce<(rustc_middle[8f79015ccec99cc5]::ty::context::TyCtxt, rustc_middle[8f79015ccec99cc5]::ty::ParamEnvAnd<rustc_middle[8f79015ccec99cc5]::mir::interpret::GlobalId>)>>::call_once
  27:     0x7fc50f3ca1f6 - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 24usize]>>
  28:     0x7fc50f3ca1af - <rustc_query_impl[becab32acd434532]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[e8a0262c3f78457e]::ops::function::FnOnce<(rustc_middle[8f79015ccec99cc5]::ty::context::TyCtxt, rustc_middle[8f79015ccec99cc5]::ty::ParamEnvAnd<rustc_middle[8f79015ccec99cc5]::mir::interpret::GlobalId>)>>::call_once
  29:     0x7fc50f3cb4e7 - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::DefaultCache<rustc_middle[8f79015ccec99cc5]::ty::ParamEnvAnd<rustc_middle[8f79015ccec99cc5]::mir::interpret::GlobalId>, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  30:     0x7fc50f3cadb0 - rustc_query_impl[becab32acd434532]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7fc50f549fa8 - rustc_middle[8f79015ccec99cc5]::query::plumbing::query_get_at::<rustc_query_system[b2408d6e81754464]::query::caches::DefaultCache<rustc_middle[8f79015ccec99cc5]::ty::ParamEnvAnd<rustc_middle[8f79015ccec99cc5]::mir::interpret::GlobalId>, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 24usize]>>>
  32:     0x7fc50f3bcd72 - <rustc_mir_build[ea1b4af1c8f1614f]::thir::pattern::PatCtxt>::lower_path
  33:     0x7fc50f3bdb50 - <rustc_mir_build[ea1b4af1c8f1614f]::thir::pattern::PatCtxt>::lower_pattern
  34:     0x7fc50f17e5ed - <rustc_mir_build[ea1b4af1c8f1614f]::thir::cx::Cx>::mirror_expr
  35:     0x7fc50f17c595 - <rustc_mir_build[ea1b4af1c8f1614f]::thir::cx::Cx>::mirror_block
  36:     0x7fc50f17cb4f - <rustc_mir_build[ea1b4af1c8f1614f]::thir::cx::Cx>::mirror_expr
  37:     0x7fc50ef02b28 - rustc_mir_build[ea1b4af1c8f1614f]::thir::cx::thir_body
  38:     0x7fc50ef0255a - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::thir_body::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 16usize]>>
  39:     0x7fc50f110005 - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::VecCache<rustc_span[b9ecb8faaa45969b]::def_id::LocalDefId, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  40:     0x7fc50ee86d53 - rustc_query_impl[becab32acd434532]::query_impl::thir_body::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7fc50ee86e3d - rustc_mir_build[ea1b4af1c8f1614f]::thir::pattern::check_match::check_match
  42:     0x7fc50ee86d87 - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::check_match::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7fc50ee862a7 - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::VecCache<rustc_span[b9ecb8faaa45969b]::def_id::LocalDefId, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  44:     0x7fc50ee85f43 - rustc_query_impl[becab32acd434532]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7fc50f185058 - rustc_mir_build[ea1b4af1c8f1614f]::build::mir_built
  46:     0x7fc50f184ec7 - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 8usize]>>
  47:     0x7fc50eceb2c3 - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::VecCache<rustc_span[b9ecb8faaa45969b]::def_id::LocalDefId, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  48:     0x7fc50eceac50 - rustc_query_impl[becab32acd434532]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  49:     0x7fc50c07a36e - rustc_mir_transform[783ba3c660dddc87]::check_unsafety::unsafety_check_result
  50:     0x7fc50eceb047 - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::unsafety_check_result::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 8usize]>>
  51:     0x7fc50eceb2c3 - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::VecCache<rustc_span[b9ecb8faaa45969b]::def_id::LocalDefId, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  52:     0x7fc50eceadd0 - rustc_query_impl[becab32acd434532]::query_impl::unsafety_check_result::get_query_non_incr::__rust_end_short_backtrace
  53:     0x7fc50ecec2b6 - rustc_mir_transform[783ba3c660dddc87]::mir_const
  54:     0x7fc50ecec1e1 - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 8usize]>>
  55:     0x7fc50eceb2c3 - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::VecCache<rustc_span[b9ecb8faaa45969b]::def_id::LocalDefId, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  56:     0x7fc50ecead10 - rustc_query_impl[becab32acd434532]::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
  57:     0x7fc50ce6c270 - rustc_mir_transform[783ba3c660dddc87]::mir_promoted
  58:     0x7fc50f10fd52 - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 16usize]>>
  59:     0x7fc50f11001b - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::VecCache<rustc_span[b9ecb8faaa45969b]::def_id::LocalDefId, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  60:     0x7fc50f10fc53 - rustc_query_impl[becab32acd434532]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  61:     0x7fc50fa1938b - rustc_borrowck[a484fd3f56712861]::mir_borrowck
  62:     0x7fc50fa192d7 - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 8usize]>>
  63:     0x7fc50eceb2c3 - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::VecCache<rustc_span[b9ecb8faaa45969b]::def_id::LocalDefId, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  64:     0x7fc50eceae90 - rustc_query_impl[becab32acd434532]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  65:     0x7fc50efb4fba - rustc_interface[840a24615f33439]::passes::analysis
  66:     0x7fc50efb4ab7 - rustc_query_impl[becab32acd434532]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[becab32acd434532]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 1usize]>>
  67:     0x7fc50fb914a4 - rustc_query_system[b2408d6e81754464]::query::plumbing::try_execute_query::<rustc_query_impl[becab32acd434532]::DynamicConfig<rustc_query_system[b2408d6e81754464]::query::caches::SingleCache<rustc_middle[8f79015ccec99cc5]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[becab32acd434532]::plumbing::QueryCtxt, false>
  68:     0x7fc50fb91295 - rustc_query_impl[becab32acd434532]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  69:     0x7fc50fb99ebf - rustc_interface[840a24615f33439]::interface::run_compiler::<core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>, rustc_driver_impl[4f97d39af0eb4c73]::run_compiler::{closure#1}>::{closure#0}
  70:     0x7fc50fba11da - std[26242507ebbaff5e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[840a24615f33439]::util::run_in_thread_with_globals<rustc_interface[840a24615f33439]::util::run_in_thread_pool_with_globals<rustc_interface[840a24615f33439]::interface::run_compiler<core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>, rustc_driver_impl[4f97d39af0eb4c73]::run_compiler::{closure#1}>::{closure#0}, core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>>::{closure#0}, core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>>
  71:     0x7fc50fba1003 - <<std[26242507ebbaff5e]::thread::Builder>::spawn_unchecked_<rustc_interface[840a24615f33439]::util::run_in_thread_with_globals<rustc_interface[840a24615f33439]::util::run_in_thread_pool_with_globals<rustc_interface[840a24615f33439]::interface::run_compiler<core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>, rustc_driver_impl[4f97d39af0eb4c73]::run_compiler::{closure#1}>::{closure#0}, core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>>::{closure#0}, core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e8a0262c3f78457e]::result::Result<(), rustc_span[b9ecb8faaa45969b]::ErrorGuaranteed>>::{closure#1} as core[e8a0262c3f78457e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  72:     0x7fc50ab986a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he287f1ba17905d90
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/alloc/src/boxed.rs:2007:9
  73:     0x7fc50ab986a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0bea5ecbe534bdc2
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/alloc/src/boxed.rs:2007:9
  74:     0x7fc50ab986a5 - std::sys::unix::thread::Thread::new::thread_start::h485bb7cda3b3ab56
                               at /rustc/d4c86cfc4984293d642e5b4f7eece60a6e83e264/library/std/src/sys/unix/thread.rs:108:17
  75:     0x7fc50a9549eb - <unknown>
  76:     0x7fc50a9d87cc - <unknown>
  77:                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: rustc 1.75.0-nightly (d4c86cfc4 2023-11-10) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [eval_to_valtree] evaluating type-level constant
#1 [thir_body] building THIR for `main`
#2 [check_match] match-checking `main`
#3 [mir_built] building MIR for `main`
#4 [unsafety_check_result] unsafety-checking `main`
#5 [mir_const] preparing `main` for borrow checking
#6 [mir_promoted] promoting constants in MIR for `main`
#7 [mir_borrowck] borrow-checking `main`
#8 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    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