Skip to content

ICE: invalid immediate for given destination place: value ScalarPair does not match ABI Scalar #140100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matthiaskrgr opened this issue Apr 21, 2025 · 2 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):



fn test()
where
    for<'a> <Foo<'a> as Bar>::Type: Sized,
{
    'b: {
        println!("hi");
        
        'c: 
        
        if true {
            break 'b;
        }
    }
}

original:

trait Bar {
    type Type;
}
struct Foo<'a>(&'a ());
impl<'a> Bar for Foo<'a> {
    type ASSUME_LIFETIMES = ();
}

fn func<'a>(_: <Foo<'a> as Bar>::repr_u8) {}
fn assert_is_func<Power>(_: fn(f: Foo)) {}

fn test()
where
    for<'a> <Foo<'a> as Bar>::Type: Sized,
{
    'b: {
        println!("hi");
        if false {
            break 'b;
        }
        'c: {
            if false {
                break 'b;
            }
            break 'c;
        }
        println!("hello");
        if true {
            break 'b;
        }
    }
}

fn main() {}

Version information

rustc 1.88.0-nightly (b8005bff3 2025-04-20)
binary: rustc
commit-hash: b8005bff3248cfc6e327faf4fa631ac49bb49ba9
commit-date: 2025-04-20
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

Possibly related line of code:

}
}
(Immediate::Uninit, _) => {
assert!(abi.is_sized(), "{msg}: unsized immediates are not a thing");
}
_ => {
bug!("{msg}: value {self:?} does not match ABI {abi:?})",)
}
}
}
pub fn clear_provenance<'tcx>(&mut self) -> InterpResult<'tcx> {
match self {

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

Program output

error: expected `while`, `for`, `loop` or `{` after a label
  --> /tmp/icemaker_global_tempdir.4Oq9irvDKofF/rustc_testrunner_tmpdir_reporting.JwSxZ3drFIdf/mvce.rs:17:9
   |
17 |         if true {
   |         ^^ expected `while`, `for`, `loop` or `{` after a label
   |
help: consider enclosing expression in a block
   |
17 ~         { if true {
18 |             break 'b;
19 ~         } }
   |

error[E0405]: cannot find trait `Bar` in this scope
  --> /tmp/icemaker_global_tempdir.4Oq9irvDKofF/rustc_testrunner_tmpdir_reporting.JwSxZ3drFIdf/mvce.rs:10:25
   |
10 |     for<'a> <Foo<'a> as Bar>::Type: Sized,
   |                         ^^^ not found in this scope

error[E0412]: cannot find type `Foo` in this scope
  --> /tmp/icemaker_global_tempdir.4Oq9irvDKofF/rustc_testrunner_tmpdir_reporting.JwSxZ3drFIdf/mvce.rs:10:14
   |
10 |     for<'a> <Foo<'a> as Bar>::Type: Sized,
   |              ^^^ not found in this scope

warning: unused label
  --> /tmp/icemaker_global_tempdir.4Oq9irvDKofF/rustc_testrunner_tmpdir_reporting.JwSxZ3drFIdf/mvce.rs:15:9
   |
15 |         'c: 
   |         ^^
   |
   = note: `#[warn(unused_labels)]` on by default

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.4Oq9irvDKofF/rustc_testrunner_tmpdir_reporting.JwSxZ3drFIdf/mvce.rs:21:2
   |
21 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.4Oq9irvDKofF/rustc_testrunner_tmpdir_reporting.JwSxZ3drFIdf/mvce.rs`

error: internal compiler error: compiler/rustc_const_eval/src/interpret/operand.rs:157:17: invalid immediate for given destination place: value ScalarPair(alloc3<imm>, 0x0000000000000003) does not match ABI Scalar(Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }))


thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/operand.rs:157:17:
Box<dyn Any>
stack backtrace:
   0:     0x74b0d1cbfa13 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd3d6a01c34b68e33
   1:     0x74b0d2405b07 - core::fmt::write::hc8609d2830ea7209
   2:     0x74b0d38a2b11 - std::io::Write::write_fmt::h5803b161d154e6bb
   3:     0x74b0d1cbf872 - std::sys::backtrace::BacktraceLock::print::h7d1ba71c4ac8a197
   4:     0x74b0d1cc31ea - std::panicking::default_hook::{{closure}}::h81636b35691bb80d
   5:     0x74b0d1cc2d6f - std::panicking::default_hook::h3d6df3ec9a366961
   6:     0x74b0d0d439a3 - std[a4b1c5db45b5369]::panicking::update_hook::<alloc[a753183b20116edd]::boxed::Box<rustc_driver_impl[64822a3bbb8e5a99]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x74b0d1cc3a63 - std::panicking::rust_panic_with_hook::hc0072f606cfb3c45
   8:     0x74b0d0d7f3a1 - std[a4b1c5db45b5369]::panicking::begin_panic::<rustc_errors[e87d3527ff012bd9]::ExplicitBug>::{closure#0}
   9:     0x74b0d0d73276 - std[a4b1c5db45b5369]::sys::backtrace::__rust_end_short_backtrace::<std[a4b1c5db45b5369]::panicking::begin_panic<rustc_errors[e87d3527ff012bd9]::ExplicitBug>::{closure#0}, !>
  10:     0x74b0d0d6faa9 - std[a4b1c5db45b5369]::panicking::begin_panic::<rustc_errors[e87d3527ff012bd9]::ExplicitBug>
  11:     0x74b0d0d89771 - <rustc_errors[e87d3527ff012bd9]::diagnostic::BugAbort as rustc_errors[e87d3527ff012bd9]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x74b0d13ce68a - rustc_middle[105e55ff3e6629a7]::util::bug::opt_span_bug_fmt::<rustc_span[f33b24d4c40821a8]::span_encoding::Span>::{closure#0}
  13:     0x74b0d13a96aa - rustc_middle[105e55ff3e6629a7]::ty::context::tls::with_opt::<rustc_middle[105e55ff3e6629a7]::util::bug::opt_span_bug_fmt<rustc_span[f33b24d4c40821a8]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x74b0d13a951b - rustc_middle[105e55ff3e6629a7]::ty::context::tls::with_context_opt::<rustc_middle[105e55ff3e6629a7]::ty::context::tls::with_opt<rustc_middle[105e55ff3e6629a7]::util::bug::opt_span_bug_fmt<rustc_span[f33b24d4c40821a8]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x74b0ce686ed0 - rustc_middle[105e55ff3e6629a7]::util::bug::bug_fmt
  16:     0x74b0d33cc1a3 - <rustc_const_eval[6f9def1c42cc4e3b]::interpret::eval_context::InterpCx<rustc_const_eval[6f9def1c42cc4e3b]::const_eval::machine::CompileTimeMachine>>::eval_rvalue_into_place
  17:     0x74b0d3368979 - rustc_const_eval[6f9def1c42cc4e3b]::const_eval::eval_queries::eval_to_allocation_raw_provider
  18:     0x74b0d33675be - rustc_query_impl[f9677782d554bbe0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f9677782d554bbe0]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[105e55ff3e6629a7]::query::erase::Erased<[u8; 24usize]>>
  19:     0x74b0d2f8e582 - rustc_query_system[6c94265d9bb07c02]::query::plumbing::try_execute_query::<rustc_query_impl[f9677782d554bbe0]::DynamicConfig<rustc_query_system[6c94265d9bb07c02]::query::caches::DefaultCache<rustc_middle[105e55ff3e6629a7]::ty::PseudoCanonicalInput<rustc_middle[105e55ff3e6629a7]::mir::interpret::GlobalId>, rustc_middle[105e55ff3e6629a7]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[f9677782d554bbe0]::plumbing::QueryCtxt, false>
  20:     0x74b0d2f8e134 - rustc_query_impl[f9677782d554bbe0]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  21:     0x74b0d2f90a85 - rustc_const_eval[6f9def1c42cc4e3b]::const_eval::eval_queries::eval_to_const_value_raw_provider
  22:     0x74b0d2f90890 - rustc_query_impl[f9677782d554bbe0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f9677782d554bbe0]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[105e55ff3e6629a7]::query::erase::Erased<[u8; 24usize]>>
  23:     0x74b0d2f8ffda - rustc_query_system[6c94265d9bb07c02]::query::plumbing::try_execute_query::<rustc_query_impl[f9677782d554bbe0]::DynamicConfig<rustc_query_system[6c94265d9bb07c02]::query::caches::DefaultCache<rustc_middle[105e55ff3e6629a7]::ty::PseudoCanonicalInput<rustc_middle[105e55ff3e6629a7]::mir::interpret::GlobalId>, rustc_middle[105e55ff3e6629a7]::query::erase::Erased<[u8; 24usize]>>, false, true, false>, rustc_query_impl[f9677782d554bbe0]::plumbing::QueryCtxt, false>
  24:     0x74b0d2f8fb74 - rustc_query_impl[f9677782d554bbe0]::query_impl::eval_to_const_value_raw::get_query_non_incr::__rust_end_short_backtrace
  25:     0x74b0d31ebd22 - <rustc_middle[105e55ff3e6629a7]::ty::context::TyCtxt>::const_eval_resolve
  26:     0x74b0d2d43270 - <rustc_mir_transform[79ecba53e0945e11]::known_panics_lint::ConstPropagator as rustc_middle[105e55ff3e6629a7]::mir::visit::Visitor>::visit_assign
  27:     0x74b0d2d3f87e - <rustc_mir_transform[79ecba53e0945e11]::known_panics_lint::ConstPropagator as rustc_middle[105e55ff3e6629a7]::mir::visit::Visitor>::visit_body
  28:     0x74b0d3258c3a - <rustc_mir_transform[79ecba53e0945e11]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[79ecba53e0945e11]::pass_manager::MirLint>::run_lint
  29:     0x74b0d240bef0 - rustc_mir_transform[79ecba53e0945e11]::run_analysis_to_runtime_passes
  30:     0x74b0d2a1fa25 - rustc_mir_transform[79ecba53e0945e11]::mir_drops_elaborated_and_const_checked
  31:     0x74b0d2a1f3e3 - rustc_query_impl[f9677782d554bbe0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f9677782d554bbe0]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[105e55ff3e6629a7]::query::erase::Erased<[u8; 8usize]>>
  32:     0x74b0d2685e2c - rustc_query_system[6c94265d9bb07c02]::query::plumbing::try_execute_query::<rustc_query_impl[f9677782d554bbe0]::DynamicConfig<rustc_data_structures[d346d185fbcc034d]::vec_cache::VecCache<rustc_span[f33b24d4c40821a8]::def_id::LocalDefId, rustc_middle[105e55ff3e6629a7]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[6c94265d9bb07c02]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f9677782d554bbe0]::plumbing::QueryCtxt, false>
  33:     0x74b0d268570f - rustc_query_impl[f9677782d554bbe0]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  34:     0x74b0d2dbac58 - rustc_interface[87387720858aeda]::passes::run_required_analyses
  35:     0x74b0d301e41e - rustc_interface[87387720858aeda]::passes::analysis
  36:     0x74b0d301e3ed - rustc_query_impl[f9677782d554bbe0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f9677782d554bbe0]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[105e55ff3e6629a7]::query::erase::Erased<[u8; 0usize]>>
  37:     0x74b0d340db3d - rustc_query_system[6c94265d9bb07c02]::query::plumbing::try_execute_query::<rustc_query_impl[f9677782d554bbe0]::DynamicConfig<rustc_query_system[6c94265d9bb07c02]::query::caches::SingleCache<rustc_middle[105e55ff3e6629a7]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f9677782d554bbe0]::plumbing::QueryCtxt, false>
  38:     0x74b0d340d838 - rustc_query_impl[f9677782d554bbe0]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  39:     0x74b0d371ee3e - rustc_interface[87387720858aeda]::passes::create_and_enter_global_ctxt::<core[89ea4ceba863dd14]::option::Option<rustc_interface[87387720858aeda]::queries::Linker>, rustc_driver_impl[64822a3bbb8e5a99]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  40:     0x74b0d3555404 - rustc_interface[87387720858aeda]::interface::run_compiler::<(), rustc_driver_impl[64822a3bbb8e5a99]::run_compiler::{closure#0}>::{closure#1}
  41:     0x74b0d32ecd68 - std[a4b1c5db45b5369]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[87387720858aeda]::util::run_in_thread_with_globals<rustc_interface[87387720858aeda]::util::run_in_thread_pool_with_globals<rustc_interface[87387720858aeda]::interface::run_compiler<(), rustc_driver_impl[64822a3bbb8e5a99]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  42:     0x74b0d32ed1b4 - <<std[a4b1c5db45b5369]::thread::Builder>::spawn_unchecked_<rustc_interface[87387720858aeda]::util::run_in_thread_with_globals<rustc_interface[87387720858aeda]::util::run_in_thread_pool_with_globals<rustc_interface[87387720858aeda]::interface::run_compiler<(), rustc_driver_impl[64822a3bbb8e5a99]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[89ea4ceba863dd14]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x74b0d32ee5b7 - std::sys::pal::unix::thread::Thread::new::thread_start::h763527da6478f178
  44:     0x74b0cd2a370a - <unknown>
  45:     0x74b0cd327aac - <unknown>
  46:                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.88.0-nightly (b8005bff3 2025-04-20) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `test::promoted[0]`
#1 [eval_to_const_value_raw] simplifying constant for the type system `test::promoted[0]`
#2 [mir_drops_elaborated_and_const_checked] elaborating drops for `test`
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors; 1 warning emitted

Some errors have detailed explanations: E0405, E0412, E0601.
For more information about an error, try `rustc --explain E0405`.

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 21, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 21, 2025
@matthiaskrgr
Copy link
Member Author

smaller:

fn a()
where
    b: Sized,
{
    println!()
}

this looks conceptioally similar to #131507 (comment) , however it bisects to a pr way later in nightly-2025-04-15, which is #139577

@lqd
Copy link
Member

lqd commented Apr 21, 2025

cc @davidtwco on that bisection, but this may have just made a known issue visible differently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants