Skip to content

Compiler panic #143750

@tuffy

Description

@tuffy

Code

#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct CDDAOffset {
    offset: u64,
}

impl CDDAOffset {
    const SAMPLES_PER_SECTOR: u64 = 44100 / 75;
}

impl TryFrom<u64> for CDDAOffset {
    type Error = ();

    fn try_from(offset: u64) -> Result<Self, Self::Error> {
        ((offset % Self::SAMPLES_PER_SECTOR) == 0)
            .then_some(Self { offset })
            .ok_or(())
    }
}

fn main() -> Result<(), Box<dyn std::error::Error>>  {
    let mut o = CDDAOffset::default();
    let do_add = || {
        // CDDAOffset doesn't implement AddAssign
        // so this should fail to compile,
        // but the compiler panics instead
        o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
        Ok(())
    };
    do_add()?;
    Ok(())
}

#[derive(Debug)]
struct TestError;

impl std::error::Error for TestError { }

impl std::fmt::Display for TestError {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        "test error".fmt(f)
    }
}

Meta

rustc --version --verbose:

rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: aarch64-apple-darwin
release: 1.88.0
LLVM version: 20.1.5

Error output

brian@MacBook-Air /t/compile-fail (master) [1]> cargo check
    Checking compile-fail v0.1.0 (/private/tmp/compile-fail)

thread 'rustc' panicked at compiler/rustc_hir_typeck/src/gather_locals.rs:112:17:
assertion `left == right` failed
  left: Some(?26t)
 right: None
stack backtrace:
   0:        0x112fa97e4 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2c3f7b4c4ce00f07
   1:        0x110599558 - core::fmt::write::h1dbafa36e52e01c5
   2:        0x112f9e118 - std::io::Write::write_fmt::he72d49f3084ee601
   3:        0x112fa96a4 - std::sys::backtrace::BacktraceLock::print::h1fb87370474572ed
   4:        0x112fae360 - std::panicking::default_hook::{{closure}}::h195a9b2c829547eb
   5:        0x112fae030 - std::panicking::default_hook::h18c3aa3e3a3584d5
   6:        0x111104724 - std[72c7846bd0c5b2df]::panicking::update_hook::<alloc[546c5ff29fefb371]::boxed::Box<rustc_driver_impl[8a44d88c4f0f23]::install_ice_hook::{closure#1}>>::{closure#0}
   7:        0x112faed48 - std::panicking::rust_panic_with_hook::h02a9fa3cad928562
   8:        0x112fae93c - std::panicking::begin_panic_handler::{{closure}}::hd1cc56578f819958
   9:        0x112fa9c88 - std::sys::backtrace::__rust_end_short_backtrace::h52c1e479035e4bc4
  10:        0x112fae604 - __rustc[4794b31dd7191200]::rust_begin_unwind
  11:        0x115be955c - core::panicking::panic_fmt::heec96bfc27e6c546
  12:        0x115be992c - core::panicking::assert_failed_inner::hed32fec0f098204f
  13:        0x115d6ade8 - core[27359fb985a9eb5]::panicking::assert_failed::<core[27359fb985a9eb5]::option::Option<rustc_middle[be4ece2d81dbf2e4]::ty::Ty>, core[27359fb985a9eb5]::option::Option<rustc_middle[be4ece2d81dbf2e4]::ty::Ty>>
  14:        0x11176f530 - <rustc_hir_typeck[82c1352f9fdf0eae]::gather_locals::GatherLocalsVisitor as rustc_hir[9ba99a8cb2087a93]::intravisit::Visitor>::visit_pat
  15:        0x11176f1a8 - <rustc_hir_typeck[82c1352f9fdf0eae]::gather_locals::GatherLocalsVisitor as rustc_hir[9ba99a8cb2087a93]::intravisit::Visitor>::visit_pat
  16:        0x1117de000 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_kind
  17:        0x1117151f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  18:        0x11179f85c - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_overloaded_binop
  19:        0x1117dbe4c - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_kind
  20:        0x1117151f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:        0x1117534b4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_block
  22:        0x1117151f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:        0x111717448 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_return_or_body_tail
  24:        0x1117ce3b8 - rustc_hir_typeck[82c1352f9fdf0eae]::check::check_fn
  25:        0x1117e6558 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_kind
  26:        0x1117151f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:        0x111752c78 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_decl
  28:        0x1117532e8 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_block
  29:        0x1117151f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:        0x111717448 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_return_or_body_tail
  31:        0x1117ce3b8 - rustc_hir_typeck[82c1352f9fdf0eae]::check::check_fn
  32:        0x11180a910 - rustc_hir_typeck[82c1352f9fdf0eae]::typeck_with_inspect::{closure#0}
  33:        0x1117cabf4 - rustc_hir_typeck[82c1352f9fdf0eae]::typeck
  34:        0x1127070a4 - rustc_query_impl[f2b4fd6c2e4cdec6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f2b4fd6c2e4cdec6]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be4ece2d81dbf2e4]::query::erase::Erased<[u8; 8usize]>>
  35:        0x11255b498 - rustc_query_system[e5df0f758f72467d]::query::plumbing::try_execute_query::<rustc_query_impl[f2b4fd6c2e4cdec6]::DynamicConfig<rustc_data_structures[f8a49ce7c8670f7e]::vec_cache::VecCache<rustc_span[93d1c13bb489426]::def_id::LocalDefId, rustc_middle[be4ece2d81dbf2e4]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[e5df0f758f72467d]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f2b4fd6c2e4cdec6]::plumbing::QueryCtxt, true>
  36:        0x112736390 - rustc_query_impl[f2b4fd6c2e4cdec6]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  37:        0x1113a758c - <rustc_middle[be4ece2d81dbf2e4]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[32f341dace8fcd26]::check_crate::{closure#3}>::{closure#0}
  38:        0x11150c658 - rustc_hir_analysis[32f341dace8fcd26]::check_crate
  39:        0x1119ee500 - rustc_interface[3c49f4d970e728]::passes::run_required_analyses
  40:        0x1119f1494 - rustc_interface[3c49f4d970e728]::passes::analysis
  41:        0x112707118 - rustc_query_impl[f2b4fd6c2e4cdec6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f2b4fd6c2e4cdec6]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be4ece2d81dbf2e4]::query::erase::Erased<[u8; 0usize]>>
  42:        0x1124d8fbc - rustc_query_system[e5df0f758f72467d]::query::plumbing::try_execute_query::<rustc_query_impl[f2b4fd6c2e4cdec6]::DynamicConfig<rustc_query_system[e5df0f758f72467d]::query::caches::SingleCache<rustc_middle[be4ece2d81dbf2e4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f2b4fd6c2e4cdec6]::plumbing::QueryCtxt, true>
  43:        0x11271325c - rustc_query_impl[f2b4fd6c2e4cdec6]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  44:        0x1110b5768 - rustc_interface[3c49f4d970e728]::passes::create_and_enter_global_ctxt::<core[27359fb985a9eb5]::option::Option<rustc_interface[3c49f4d970e728]::queries::Linker>, rustc_driver_impl[8a44d88c4f0f23]::run_compiler::{closure#0}::{closure#2}>
  45:        0x111101524 - rustc_interface[3c49f4d970e728]::interface::run_compiler::<(), rustc_driver_impl[8a44d88c4f0f23]::run_compiler::{closure#0}>::{closure#1}
  46:        0x1110f247c - std[72c7846bd0c5b2df]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3c49f4d970e728]::util::run_in_thread_with_globals<rustc_interface[3c49f4d970e728]::util::run_in_thread_pool_with_globals<rustc_interface[3c49f4d970e728]::interface::run_compiler<(), rustc_driver_impl[8a44d88c4f0f23]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  47:        0x111107ee0 - <<std[72c7846bd0c5b2df]::thread::Builder>::spawn_unchecked_<rustc_interface[3c49f4d970e728]::util::run_in_thread_with_globals<rustc_interface[3c49f4d970e728]::util::run_in_thread_pool_with_globals<rustc_interface[3c49f4d970e728]::interface::run_compiler<(), rustc_driver_impl[8a44d88c4f0f23]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[27359fb985a9eb5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:        0x112fb128c - std::sys::pal::unix::thread::Thread::new::thread_start::hf0cf67e969add794
  49:        0x1863eec0c - __pthread_cond_wait

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: rustc 1.88.0 (6b00bc388 2025-06-23) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

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

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: this path really should be doomed...
  --> src/main.rs:26:11
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |           ^^
   |
note: delayed at compiler/rustc_hir_typeck/src/op.rs:1003:28 - disabled backtrace
  --> src/main.rs:26:11
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |           ^^

error: internal compiler error: `fn(_) -> ControlFlow<<_ as Try>::Residual, <_ as Try>::Output> {<_ as Try>::branch}` overridden by `fn(_) -> ControlFlow<<_ as Try>::Residual, <_ as Try>::Output> {<_ as Try>::branch}` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).32) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: `CDDAOffset` overridden by `CDDAOffset` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).23) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^

error: internal compiler error: `fn(_) -> Result<CDDAOffset, <CDDAOffset as TryFrom<_>>::Error> {<CDDAOffset as TryFrom<_>>::try_from}` overridden by `fn(_) -> Result<CDDAOffset, <CDDAOffset as TryFrom<_>>::Error> {<CDDAOffset as TryFrom<_>>::try_from}` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).21) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: `{integer}` overridden by `{integer}` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).25) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:35
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                   ^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:35
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                   ^

error: internal compiler error: `Result<CDDAOffset, ()>` overridden by `Result<CDDAOffset, ()>` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).20) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: `_` overridden by `_` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).31) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^

error: internal compiler error: `()` overridden by `()` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).28) in DefId(0:10 ~ compile_fail[bfd0]::main::{closure#0}::{closure#0})
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^

error: internal compiler error: `()` overridden by `()` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).27) in DefId(0:10 ~ compile_fail[bfd0]::main::{closure#0}::{closure#0})
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^

error: internal compiler error: `TestError` overridden by `TestError` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).29) in DefId(0:10 ~ compile_fail[bfd0]::main::{closure#0}::{closure#0})
  --> src/main.rs:26:51
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                                   ^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:51
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                                   ^^^^^^^^^

error: internal compiler error: `{closure@src/main.rs:26:46: 26:50}` overridden by `{closure@src/main.rs:26:46: 26:50}` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).26) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:46
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                              ^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:46
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                              ^^^^

error: internal compiler error: `Result<CDDAOffset, TestError>` overridden by `Result<CDDAOffset, TestError>` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).18) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: `ControlFlow<Result<Infallible, TestError>, CDDAOffset>` overridden by `ControlFlow<Result<Infallible, TestError>, CDDAOffset>` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).33) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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.88.0 (6b00bc388 2025-06-23) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
error: could not compile `compile-fail` (bin "compile-fail")

Caused by:
  process didn't exit successfully: `/Users/brian/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name compile_fail --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=223 --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=27863bdfad737244 -C extra-filename=-609e66a6bb487dbe --out-dir /private/tmp/compile-fail/target/debug/deps -C incremental=/private/tmp/compile-fail/target/debug/incremental -L dependency=/private/tmp/compile-fail/target/debug/deps` (exit status: 101)
Backtrace

    Checking compile-fail v0.1.0 (/private/tmp/compile-fail)

thread 'rustc' panicked at compiler/rustc_hir_typeck/src/gather_locals.rs:112:17:
assertion `left == right` failed
  left: Some(?26t)
 right: None
stack backtrace:
   0:        0x10e8957e4 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2c3f7b4c4ce00f07
   1:        0x10be85558 - core::fmt::write::h1dbafa36e52e01c5
   2:        0x10e88a118 - std::io::Write::write_fmt::he72d49f3084ee601
   3:        0x10e8956a4 - std::sys::backtrace::BacktraceLock::print::h1fb87370474572ed
   4:        0x10e89a360 - std::panicking::default_hook::{{closure}}::h195a9b2c829547eb
   5:        0x10e89a030 - std::panicking::default_hook::h18c3aa3e3a3584d5
   6:        0x10c9f0724 - std[72c7846bd0c5b2df]::panicking::update_hook::<alloc[546c5ff29fefb371]::boxed::Box<rustc_driver_impl[8a44d88c4f0f23]::install_ice_hook::{closure#1}>>::{closure#0}
   7:        0x10e89ad48 - std::panicking::rust_panic_with_hook::h02a9fa3cad928562
   8:        0x10e89a93c - std::panicking::begin_panic_handler::{{closure}}::hd1cc56578f819958
   9:        0x10e895c88 - std::sys::backtrace::__rust_end_short_backtrace::h52c1e479035e4bc4
  10:        0x10e89a604 - __rustc[4794b31dd7191200]::rust_begin_unwind
  11:        0x1114d555c - core::panicking::panic_fmt::heec96bfc27e6c546
  12:        0x1114d592c - core::panicking::assert_failed_inner::hed32fec0f098204f
  13:        0x111656de8 - core[27359fb985a9eb5]::panicking::assert_failed::<core[27359fb985a9eb5]::option::Option<rustc_middle[be4ece2d81dbf2e4]::ty::Ty>, core[27359fb985a9eb5]::option::Option<rustc_middle[be4ece2d81dbf2e4]::ty::Ty>>
  14:        0x10d05b530 - <rustc_hir_typeck[82c1352f9fdf0eae]::gather_locals::GatherLocalsVisitor as rustc_hir[9ba99a8cb2087a93]::intravisit::Visitor>::visit_pat
  15:        0x10d05b1a8 - <rustc_hir_typeck[82c1352f9fdf0eae]::gather_locals::GatherLocalsVisitor as rustc_hir[9ba99a8cb2087a93]::intravisit::Visitor>::visit_pat
  16:        0x10d0ca000 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_kind
  17:        0x10d0011f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  18:        0x10d08b85c - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_overloaded_binop
  19:        0x10d0c7e4c - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_kind
  20:        0x10d0011f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:        0x10d03f4b4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_block
  22:        0x10d0011f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:        0x10d003448 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_return_or_body_tail
  24:        0x10d0ba3b8 - rustc_hir_typeck[82c1352f9fdf0eae]::check::check_fn
  25:        0x10d0d2558 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_kind
  26:        0x10d0011f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:        0x10d03ec78 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_decl
  28:        0x10d03f2e8 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_block
  29:        0x10d0011f4 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:        0x10d003448 - <rustc_hir_typeck[82c1352f9fdf0eae]::fn_ctxt::FnCtxt>::check_return_or_body_tail
  31:        0x10d0ba3b8 - rustc_hir_typeck[82c1352f9fdf0eae]::check::check_fn
  32:        0x10d0f6910 - rustc_hir_typeck[82c1352f9fdf0eae]::typeck_with_inspect::{closure#0}
  33:        0x10d0b6bf4 - rustc_hir_typeck[82c1352f9fdf0eae]::typeck
  34:        0x10dff30a4 - rustc_query_impl[f2b4fd6c2e4cdec6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f2b4fd6c2e4cdec6]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be4ece2d81dbf2e4]::query::erase::Erased<[u8; 8usize]>>
  35:        0x10de47498 - rustc_query_system[e5df0f758f72467d]::query::plumbing::try_execute_query::<rustc_query_impl[f2b4fd6c2e4cdec6]::DynamicConfig<rustc_data_structures[f8a49ce7c8670f7e]::vec_cache::VecCache<rustc_span[93d1c13bb489426]::def_id::LocalDefId, rustc_middle[be4ece2d81dbf2e4]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[e5df0f758f72467d]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f2b4fd6c2e4cdec6]::plumbing::QueryCtxt, true>
  36:        0x10e022390 - rustc_query_impl[f2b4fd6c2e4cdec6]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  37:        0x10cc9358c - <rustc_middle[be4ece2d81dbf2e4]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[32f341dace8fcd26]::check_crate::{closure#3}>::{closure#0}
  38:        0x10cdf8658 - rustc_hir_analysis[32f341dace8fcd26]::check_crate
  39:        0x10d2da500 - rustc_interface[3c49f4d970e728]::passes::run_required_analyses
  40:        0x10d2dd494 - rustc_interface[3c49f4d970e728]::passes::analysis
  41:        0x10dff3118 - rustc_query_impl[f2b4fd6c2e4cdec6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f2b4fd6c2e4cdec6]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be4ece2d81dbf2e4]::query::erase::Erased<[u8; 0usize]>>
  42:        0x10ddc4fbc - rustc_query_system[e5df0f758f72467d]::query::plumbing::try_execute_query::<rustc_query_impl[f2b4fd6c2e4cdec6]::DynamicConfig<rustc_query_system[e5df0f758f72467d]::query::caches::SingleCache<rustc_middle[be4ece2d81dbf2e4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f2b4fd6c2e4cdec6]::plumbing::QueryCtxt, true>
  43:        0x10dfff25c - rustc_query_impl[f2b4fd6c2e4cdec6]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  44:        0x10c9a1768 - rustc_interface[3c49f4d970e728]::passes::create_and_enter_global_ctxt::<core[27359fb985a9eb5]::option::Option<rustc_interface[3c49f4d970e728]::queries::Linker>, rustc_driver_impl[8a44d88c4f0f23]::run_compiler::{closure#0}::{closure#2}>
  45:        0x10c9ed524 - rustc_interface[3c49f4d970e728]::interface::run_compiler::<(), rustc_driver_impl[8a44d88c4f0f23]::run_compiler::{closure#0}>::{closure#1}
  46:        0x10c9de47c - std[72c7846bd0c5b2df]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3c49f4d970e728]::util::run_in_thread_with_globals<rustc_interface[3c49f4d970e728]::util::run_in_thread_pool_with_globals<rustc_interface[3c49f4d970e728]::interface::run_compiler<(), rustc_driver_impl[8a44d88c4f0f23]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  47:        0x10c9f3ee0 - <<std[72c7846bd0c5b2df]::thread::Builder>::spawn_unchecked_<rustc_interface[3c49f4d970e728]::util::run_in_thread_with_globals<rustc_interface[3c49f4d970e728]::util::run_in_thread_pool_with_globals<rustc_interface[3c49f4d970e728]::interface::run_compiler<(), rustc_driver_impl[8a44d88c4f0f23]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[27359fb985a9eb5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:        0x10e89d28c - std::sys::pal::unix::thread::Thread::new::thread_start::hf0cf67e969add794
  49:        0x1863eec0c - __pthread_cond_wait

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: rustc 1.88.0 (6b00bc388 2025-06-23) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

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

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: this path really should be doomed...
  --> src/main.rs:26:11
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |           ^^
   |
note: delayed at compiler/rustc_hir_typeck/src/op.rs:1003:28 - disabled backtrace
  --> src/main.rs:26:11
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |           ^^

error: internal compiler error: `fn(_) -> ControlFlow<<_ as Try>::Residual, <_ as Try>::Output> {<_ as Try>::branch}` overridden by `fn(_) -> ControlFlow<<_ as Try>::Residual, <_ as Try>::Output> {<_ as Try>::branch}` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).32) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: `CDDAOffset` overridden by `CDDAOffset` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).23) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^

error: internal compiler error: `fn(_) -> Result<CDDAOffset, <CDDAOffset as TryFrom<_>>::Error> {<CDDAOffset as TryFrom<_>>::try_from}` overridden by `fn(_) -> Result<CDDAOffset, <CDDAOffset as TryFrom<_>>::Error> {<CDDAOffset as TryFrom<_>>::try_from}` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).21) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: `{integer}` overridden by `{integer}` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).25) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:35
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                   ^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:35
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                   ^

error: internal compiler error: `Result<CDDAOffset, ()>` overridden by `Result<CDDAOffset, ()>` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).20) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: `_` overridden by `_` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).31) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^

error: internal compiler error: `()` overridden by `()` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).28) in DefId(0:10 ~ compile_fail[bfd0]::main::{closure#0}::{closure#0})
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^

error: internal compiler error: `()` overridden by `()` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).27) in DefId(0:10 ~ compile_fail[bfd0]::main::{closure#0}::{closure#0})
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:47
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                               ^^

error: internal compiler error: `TestError` overridden by `TestError` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).29) in DefId(0:10 ~ compile_fail[bfd0]::main::{closure#0}::{closure#0})
  --> src/main.rs:26:51
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                                   ^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:51
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                                   ^^^^^^^^^

error: internal compiler error: `{closure@src/main.rs:26:46: 26:50}` overridden by `{closure@src/main.rs:26:46: 26:50}` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).26) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:46
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                              ^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:46
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |                                              ^^^^

error: internal compiler error: `Result<CDDAOffset, TestError>` overridden by `Result<CDDAOffset, TestError>` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).18) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: `ControlFlow<Result<Infallible, TestError>, CDDAOffset>` overridden by `ControlFlow<Result<Infallible, TestError>, CDDAOffset>` for HirId(DefId(0:8 ~ compile_fail[bfd0]::main).33) in DefId(0:9 ~ compile_fail[bfd0]::main::{closure#0})
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
  --> src/main.rs:26:14
   |
26 |         o += CDDAOffset::try_from(0).map_err(|()| TestError)?;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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.88.0 (6b00bc388 2025-06-23) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
error: could not compile `compile-fail` (bin "compile-fail")

Caused by:
  process didn't exit successfully: `/Users/brian/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name compile_fail --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=223 --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=27863bdfad737244 -C extra-filename=-609e66a6bb487dbe --out-dir /private/tmp/compile-fail/target/debug/deps -C incremental=/private/tmp/compile-fail/target/debug/incremental -L dependency=/private/tmp/compile-fail/target/debug/deps` (exit status: 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    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