Skip to content

ICE: mir opts crash rustc with -Zmir-preserve-ub in compiler/rustc_mir_transform/src/simplify_comparison_integral.rs #141454

@matthiaskrgr

Description

@matthiaskrgr
Member

Code

MIRIFLAGS=" -Zmir-opt-level=1" cargo miri run

#![feature(never_type)]

fn main() {
    let x: &[!] = &[];

    match x {
        &[] => (),
        &[..] => (),
    };

}

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (2eef47813 2025-05-22)
binary: rustc
commit-hash: 2eef47813f25df637026ce3288880e5c587abd92
commit-date: 2025-05-22
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5

Error output

<output>
Backtrace

WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
     Running `/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner target/miri/x86_64-unknown-linux-gnu/debug/f`
warning: You have explicitly enabled MIR optimizations, overriding Miri's default which is to completely disable them. Any optimizations may hide UB that Miri would otherwise detect, and it is not necessarily possible to predict what kind of UB will be missed. If you are enabling optimizations to make Miri run faster, we advise using cfg(miri) to shrink your workload instead. The performance benefit of enabling MIR optimizations is usually marginal at best.


thread 'rustc' panicked at compiler/rustc_mir_transform/src/simplify_comparison_integral.rs:58:57:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7b8cd835e4c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h791cca59c2eeee28
   1:     0x7b8cd8a057f7 - core::fmt::write::h97a7af820072d676
   2:     0x7b8cd9ae9cd1 - std::io::Write::write_fmt::h1245a83c9368b241
   3:     0x7b8cd835e322 - std::sys::backtrace::BacktraceLock::print::h7ac4e02696d52df5
   4:     0x7b8cd8361f1a - std::panicking::default_hook::{{closure}}::h8eb31dccbdecdf8a
   5:     0x7b8cd8361a9f - std::panicking::default_hook::h91e0d8dc8f06c0a3
   6:     0x7b8cd7389c83 - std[4968f2f03965d2e2]::panicking::update_hook::<alloc[f94e5fe99def039a]::boxed::Box<rustc_driver_impl[7dbfdb670cae9b1b]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7b8cd8362793 - std::panicking::rust_panic_with_hook::h361c0cc0b5542574
   8:     0x7b8cd8362456 - std::panicking::begin_panic_handler::{{closure}}::hc4fbc10250e9e65d
   9:     0x7b8cd835e999 - std::sys::backtrace::__rust_end_short_backtrace::hc3ffdf64e78c2fbe
  10:     0x7b8cd836214d - __rustc[ed2da27af75a8cb8]::rust_begin_unwind
  11:     0x7b8cd4c88de0 - core::panicking::panic_fmt::hf0c30228c7d5a750
  12:     0x7b8cd4c8d21c - core::panicking::panic::h4836dc76500b11ed
  13:     0x7b8cd4c89819 - core::option::unwrap_failed::hb8f099542654f599
  14:     0x7b8cd8bf9a20 - <rustc_mir_transform[d1ca8fc46b54c91b]::simplify_comparison_integral::SimplifyComparisonIntegral as rustc_mir_transform[d1ca8fc46b54c91b]::pass_manager::MirPass>::run_pass
  15:     0x7b8cd8a036bd - rustc_mir_transform[d1ca8fc46b54c91b]::pass_manager::run_passes_inner
  16:     0x7b8cd96c587d - rustc_mir_transform[d1ca8fc46b54c91b]::run_optimization_passes
  17:     0x7b8cd96c323b - rustc_mir_transform[d1ca8fc46b54c91b]::optimized_mir
  18:     0x7b8cd96c2ddd - rustc_query_impl[8d9b4f0db2c9623]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8d9b4f0db2c9623]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d8138b7bea7b651b]::query::erase::Erased<[u8; 8usize]>>
  19:     0x7b8cd8cf857f - rustc_query_system[eaf5d02d08bb0d89]::query::plumbing::try_execute_query::<rustc_query_impl[8d9b4f0db2c9623]::DynamicConfig<rustc_query_system[eaf5d02d08bb0d89]::query::caches::DefIdCache<rustc_middle[d8138b7bea7b651b]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8d9b4f0db2c9623]::plumbing::QueryCtxt, true>
  20:     0x7b8cd8cf58d0 - rustc_query_impl[8d9b4f0db2c9623]::query_impl::optimized_mir::get_query_incr::__rust_end_short_backtrace
  21:     0x7b8cd92c0bb5 - <rustc_middle[d8138b7bea7b651b]::ty::context::TyCtxt>::instance_mir
  22:     0x62daca283e8a - <rustc_const_eval[c16e0604a393eedb]::interpret::eval_context::InterpCx<miri[478955529d09d100]::machine::MiriMachine>>::init_fn_call
  23:     0x62daca2e7a10 - <rustc_const_eval[c16e0604a393eedb]::interpret::eval_context::InterpCx<miri[478955529d09d100]::machine::MiriMachine> as miri[478955529d09d100]::concurrency::thread::EvalContextExt>::run_threads
  24:     0x62daca2f9cc4 - miri[478955529d09d100]::eval::eval_entry
  25:     0x62daca41c699 - <miri[4a277e2e70c10989]::MiriCompilerCalls as rustc_driver_impl[7dbfdb670cae9b1b]::Callbacks>::after_analysis
  26:     0x7b8cd9bb3822 - rustc_interface[1a7f6db5e55683ee]::passes::create_and_enter_global_ctxt::<core[2747f52fe7825488]::option::Option<rustc_interface[1a7f6db5e55683ee]::queries::Linker>, rustc_driver_impl[7dbfdb670cae9b1b]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  27:     0x7b8cd9af50cf - rustc_interface[1a7f6db5e55683ee]::interface::run_compiler::<(), rustc_driver_impl[7dbfdb670cae9b1b]::run_compiler::{closure#0}>::{closure#1}
  28:     0x7b8cd9ab23c6 - std[4968f2f03965d2e2]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1a7f6db5e55683ee]::util::run_in_thread_with_globals<rustc_interface[1a7f6db5e55683ee]::util::run_in_thread_pool_with_globals<rustc_interface[1a7f6db5e55683ee]::interface::run_compiler<(), rustc_driver_impl[7dbfdb670cae9b1b]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  29:     0x7b8cd9ab206b - <<std[4968f2f03965d2e2]::thread::Builder>::spawn_unchecked_<rustc_interface[1a7f6db5e55683ee]::util::run_in_thread_with_globals<rustc_interface[1a7f6db5e55683ee]::util::run_in_thread_pool_with_globals<rustc_interface[1a7f6db5e55683ee]::interface::run_compiler<(), rustc_driver_impl[7dbfdb670cae9b1b]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[2747f52fe7825488]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7b8cd9ab33bd - std::sys::pal::unix::thread::Thread::new::thread_start::h580e41b37d177b5f
  31:     0x7b8cd37ad7eb - <unknown>
  32:     0x7b8cd383118c - <unknown>
  33:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/miri/issues/new

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/f/rustc-ice-2025-05-23T15_15_42-1289116.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -C target-cpu=native -Z mir-opt-level=1

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] optimizing MIR for `main`
end of query stack

Miri caused an ICE during evaluation. Here's the interpreter backtrace at the time of the panic:
note: the place in the program where the ICE was triggered
   --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
    |
250 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: BACKTRACE:
    = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5: 250:71
    = note: inside `std::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152:18: 152:21
    = note: inside closure at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:206:18: 206:75
    = note: inside `std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:284:13: 284:31
    = note: inside `std::panicking::r#try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:589:40: 589:43
    = note: inside `std::panicking::r#try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:552:19: 552:88
    = note: inside `std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14: 359:33
    = note: inside closure at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:175:24: 175:49
    = note: inside `std::panicking::r#try::do_call::<{closure@std::rt::lang_start_internal::{closure#0}}, isize>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:589:40: 589:43
    = note: inside `std::panicking::r#try::<isize, {closure@std::rt::lang_start_internal::{closure#0}}>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:552:19: 552:88
    = note: inside `std::panic::catch_unwind::<{closure@std::rt::lang_start_internal::{closure#0}}, isize>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14: 359:33
    = note: inside `std::rt::lang_start_internal` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:171:5: 193:7
    = note: inside `std::rt::lang_start::<()>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:205:5: 210:6

warning: 1 warning emitted

Activity

added
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.
C-bugCategory: This is a bug.
on May 23, 2025
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 23, 2025
saethlin

saethlin commented on May 23, 2025

@saethlin
Member

This smells like -Zmir-preserve-ub.

RalfJung

RalfJung commented on May 24, 2025

@RalfJung
Member

Yeah, here's a non-Miri reproducer: https://rust.godbolt.org/z/Ebh87vrja
Just pass the same code to rustc with -Zmir-opt-level=1 -Zmir-preserve-ub.

removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 24, 2025
matthiaskrgr

matthiaskrgr commented on Jun 1, 2025

@matthiaskrgr
MemberAuthor

also reproducible with just

//@compile-flags: -Clink-dead-code  -Zmir-preserve-ub
pub fn main() {
    {|i: u32| if 1 == i { }};
}
warning: unused closure that must be used
 --> a.rs:2:6
  |
2 |     {|i: u32| if 1 == i { }};
  |      ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: closures are lazy and do nothing unless called
  = note: `#[warn(unused_must_use)]` on by default


thread 'rustc' panicked at compiler/rustc_mir_transform/src/simplify_comparison_integral.rs:58:57:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7c675bad95c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd662187fa65adc29
   1:     0x7c675c203237 - core::fmt::write::hd2e858ad8da95d8f
   2:     0x7c675bacf243 - std::io::Write::write_fmt::h5875566df214f71b
   3:     0x7c675bad9422 - std::sys::backtrace::BacktraceLock::print::hcb48fa16d65f0ce5
   4:     0x7c675badd01a - std::panicking::default_hook::{{closure}}::ha568e21decd2da2d
   5:     0x7c675badcb9f - std::panicking::default_hook::h8abddf8e14261018
   6:     0x7c675abf6063 - std[cc92051fbd9fbf1b]::panicking::update_hook::<alloc[6f3ab62ffd95a67]::boxed::Box<rustc_driver_impl[9a023a3f5673a8b1]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7c675badd893 - std::panicking::rust_panic_with_hook::hd54c2d95158ab96f
   8:     0x7c675badd556 - std::panicking::begin_panic_handler::{{closure}}::hfd7f876baf1c59c7
   9:     0x7c675bad9a89 - std::sys::backtrace::__rust_end_short_backtrace::h7f86266112cbeae7
  10:     0x7c675badd24d - __rustc[4ab717748c90b11f]::rust_begin_unwind
  11:     0x7c67582a7680 - core::panicking::panic_fmt::h04f727a682e30ffc
  12:     0x7c67584d6bcc - core::panicking::panic::h5ba4abb5d8ea3c66
  13:     0x7c67582a8fe9 - core::option::unwrap_failed::hb08f8c99b990160c
  14:     0x7c675c74a42d - <rustc_mir_transform[385165b6d1d64545]::simplify_comparison_integral::SimplifyComparisonIntegral as rustc_mir_transform[385165b6d1d64545]::pass_manager::MirPass>::run_pass
  15:     0x7c675c210722 - rustc_mir_transform[385165b6d1d64545]::run_optimization_passes
  16:     0x7c675cf0b4dc - rustc_mir_transform[385165b6d1d64545]::optimized_mir
  17:     0x7c675cf0ac9d - rustc_query_impl[b77c6f8cb19653a9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b77c6f8cb19653a9]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[df2370e964d8f985]::query::erase::Erased<[u8; 8usize]>>
  18:     0x7c675c225a25 - rustc_query_system[ed6664503426668a]::query::plumbing::try_execute_query::<rustc_query_impl[b77c6f8cb19653a9]::DynamicConfig<rustc_query_system[ed6664503426668a]::query::caches::DefIdCache<rustc_middle[df2370e964d8f985]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b77c6f8cb19653a9]::plumbing::QueryCtxt, false>
  19:     0x7c675c224e5b - rustc_query_impl[b77c6f8cb19653a9]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  20:     0x7c67589e1466 - <rustc_middle[df2370e964d8f985]::ty::context::TyCtxt>::instance_mir
  21:     0x7c675935b8b7 - rustc_monomorphize[50c3148d11e1eb79]::mono_checks::check_mono_item
  22:     0x7c675cb51b20 - rustc_query_impl[b77c6f8cb19653a9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b77c6f8cb19653a9]::query_impl::check_mono_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle[df2370e964d8f985]::query::erase::Erased<[u8; 0usize]>>
  23:     0x7c675cc5f4b3 - rustc_query_system[ed6664503426668a]::query::plumbing::try_execute_query::<rustc_query_impl[b77c6f8cb19653a9]::DynamicConfig<rustc_query_system[ed6664503426668a]::query::caches::DefaultCache<rustc_middle[df2370e964d8f985]::ty::instance::Instance, rustc_middle[df2370e964d8f985]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[b77c6f8cb19653a9]::plumbing::QueryCtxt, false>
  24:     0x7c675cc5f151 - rustc_query_impl[b77c6f8cb19653a9]::query_impl::check_mono_item::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7c675cc67fd0 - rustc_monomorphize[50c3148d11e1eb79]::collector::items_of_instance
  26:     0x7c675cc67e4c - rustc_query_impl[b77c6f8cb19653a9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b77c6f8cb19653a9]::query_impl::items_of_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[df2370e964d8f985]::query::erase::Erased<[u8; 32usize]>>
  27:     0x7c675cc7edab - rustc_query_system[ed6664503426668a]::query::plumbing::try_execute_query::<rustc_query_impl[b77c6f8cb19653a9]::DynamicConfig<rustc_query_system[ed6664503426668a]::query::caches::DefaultCache<(rustc_middle[df2370e964d8f985]::ty::instance::Instance, rustc_middle[df2370e964d8f985]::mir::mono::CollectionMode), rustc_middle[df2370e964d8f985]::query::erase::Erased<[u8; 32usize]>>, false, false, false>, rustc_query_impl[b77c6f8cb19653a9]::plumbing::QueryCtxt, false>
  28:     0x7c675cc7e9ed - rustc_query_impl[b77c6f8cb19653a9]::query_impl::items_of_instance::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7c675cc81c41 - rustc_monomorphize[50c3148d11e1eb79]::collector::collect_items_rec
  30:     0x7c675cb5987f - rustc_monomorphize[50c3148d11e1eb79]::collector::collect_crate_mono_items::{closure#1}::{closure#0}
  31:     0x7c675ca02132 - rustc_monomorphize[50c3148d11e1eb79]::partitioning::collect_and_partition_mono_items
  32:     0x7c675d6bcc96 - rustc_query_impl[b77c6f8cb19653a9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b77c6f8cb19653a9]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[df2370e964d8f985]::query::erase::Erased<[u8; 40usize]>>
  33:     0x7c675d6bcc73 - <rustc_query_impl[b77c6f8cb19653a9]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[62e845a46ff60d72]::ops::function::FnOnce<(rustc_middle[df2370e964d8f985]::ty::context::TyCtxt, ())>>::call_once
  34:     0x7c675d6bc7a3 - rustc_query_system[ed6664503426668a]::query::plumbing::try_execute_query::<rustc_query_impl[b77c6f8cb19653a9]::DynamicConfig<rustc_query_system[ed6664503426668a]::query::caches::SingleCache<rustc_middle[df2370e964d8f985]::query::erase::Erased<[u8; 40usize]>>, false, false, false>, rustc_query_impl[b77c6f8cb19653a9]::plumbing::QueryCtxt, false>
  35:     0x7c675d6bc543 - rustc_query_impl[b77c6f8cb19653a9]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7c675d2d1da6 - <rustc_codegen_llvm[7ce68372b1c00100]::LlvmCodegenBackend as rustc_codegen_ssa[5e74e9c47c01990c]::traits::backend::CodegenBackend>::codegen_crate
  37:     0x7c675d439d57 - <rustc_interface[3b1a95ec3e1e4d12]::queries::Linker>::codegen_and_build_linker
  38:     0x7c675d437a30 - rustc_interface[3b1a95ec3e1e4d12]::passes::create_and_enter_global_ctxt::<core[62e845a46ff60d72]::option::Option<rustc_interface[3b1a95ec3e1e4d12]::queries::Linker>, rustc_driver_impl[9a023a3f5673a8b1]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  39:     0x7c675d42908c - rustc_interface[3b1a95ec3e1e4d12]::interface::run_compiler::<(), rustc_driver_impl[9a023a3f5673a8b1]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7c675d4905be - std[cc92051fbd9fbf1b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3b1a95ec3e1e4d12]::util::run_in_thread_with_globals<rustc_interface[3b1a95ec3e1e4d12]::util::run_in_thread_pool_with_globals<rustc_interface[3b1a95ec3e1e4d12]::interface::run_compiler<(), rustc_driver_impl[9a023a3f5673a8b1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  41:     0x7c675d490296 - <<std[cc92051fbd9fbf1b]::thread::Builder>::spawn_unchecked_<rustc_interface[3b1a95ec3e1e4d12]::util::run_in_thread_with_globals<rustc_interface[3b1a95ec3e1e4d12]::util::run_in_thread_pool_with_globals<rustc_interface[3b1a95ec3e1e4d12]::interface::run_compiler<(), rustc_driver_impl[9a023a3f5673a8b1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[62e845a46ff60d72]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7c675d49357d - std::sys::pal::unix::thread::Thread::new::thread_start::h263e46d47d4b59bd
  43:     0x7c6756ea57eb - <unknown>
  44:     0x7c6756f2918c - <unknown>
  45:                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 `/tmp/im/rustc-ice-2025-06-01T14_26_34-1606700.txt` to your bug report

note: compiler flags: -C link-dead-code -Z mir-preserve-ub

query stack during panic:
#0 [optimized_mir] optimizing MIR for `main::{closure#0}`
#1 [check_mono_item] monomorphization-time checking
#2 [items_of_instance] collecting items used by `main::{closure#0}`
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
warning: 1 warning emitted
matthiaskrgr

matthiaskrgr commented on Jun 1, 2025

@matthiaskrgr
MemberAuthor

bisection points to #139042 🤔

edit: wait, looks like this just renamed the flag..

edit2: it may be that this pr is actually the culprint, at least previous nighlty
~/.rustup/toolchains/nightly-2025-04-17-x86_64-unknown-linux-gnu/bin/rustc a.rs -Clink-dead-code -Zmir-keep-place-mention

does not seem to repro for me

changed the title [-]ICE: mir opts crash miri in compiler/rustc_mir_transform/src/simplify_comparison_integral.rs[/-] [+]ICE: mir opts crash rustc with -Zmir-preserve-ub in compiler/rustc_mir_transform/src/simplify_comparison_integral.rs[/+] on Jun 1, 2025

1 remaining item

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-mir-optArea: MIR optimizationsC-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

        Participants

        @RalfJung@matthiaskrgr@saethlin@rustbot

        Issue actions

          ICE: mir opts crash rustc with -Zmir-preserve-ub in compiler/rustc_mir_transform/src/simplify_comparison_integral.rs · Issue #141454 · rust-lang/rust