Skip to content

ICE in Option<&OsStr> + Option<&OsStr> #143510

@HildarTheDorf

Description

@HildarTheDorf

Yes, this is invalid code, but it still shouldn't explode with an ICE. Does not occur on nightly.

Code

use std::ffi::{OsStr};

fn foo(p1: Option<&OsStr>, p2: Option<&OsStr>) -> Option<()> {
    p1? + p2?;
    Ok(());
}

Meta

rustc --version --verbose:

karenw@adrammelech:~/src/iceostradd$ rustc --version --verbose
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5

Error output

karenw@adrammelech:~/src/iceostradd$ cargo build
   Compiling iceostradd v0.1.0 (/home/karenw/src/iceostradd)

thread 'rustc' panicked at compiler/rustc_hir_typeck/src/gather_locals.rs:112:17:
assertion `left == right` failed
  left: Some(?32t)
 right: None
stack backtrace:
   0:     0x74b227d46543 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h46a716bba2450163
   1:     0x74b228405947 - core::fmt::write::h275e5980d7008551
   2:     0x74b2294c16d1 - std::io::Write::write_fmt::h561a66a0340b6995
   3:     0x74b227d463a2 - std::sys::backtrace::BacktraceLock::print::hafb9d5969adc39a0
   4:     0x74b227d49f9a - std::panicking::default_hook::{{closure}}::hae2e97a5c4b2b777
   5:     0x74b227d49b1f - std::panicking::default_hook::h3db1b505cfc4eb79
   6:     0x74b226d75b93 - std[61bb86a81f0491]::panicking::update_hook::<alloc[7c55b5a5cf9e3c5f]::boxed::Box<rustc_driver_impl[b7d73271a09ede7d]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x74b227d4a813 - std::panicking::rust_panic_with_hook::h409da73ddef13937
   8:     0x74b227d4a50a - std::panicking::begin_panic_handler::{{closure}}::h159b61b27f96a9c2
   9:     0x74b227d46a09 - std::sys::backtrace::__rust_end_short_backtrace::h5b56844d75e766fc
  10:     0x74b227d4a1cd - __rustc[4794b31dd7191200]::rust_begin_unwind
  11:     0x74b224685620 - core::panicking::panic_fmt::hc8737e8cca20a7c8
  12:     0x74b2266f7faa - core::panicking::assert_failed_inner::h1eff0b41c54ffee0
  13:     0x74b227a7ce4b - core[105cb658ab12d76f]::panicking::assert_failed::<core[105cb658ab12d76f]::option::Option<rustc_middle[1134768a56a896b4]::ty::Ty>, core[105cb658ab12d76f]::option::Option<rustc_middle[1134768a56a896b4]::ty::Ty>>
  14:     0x74b2287ea3dd - <rustc_hir_typeck[69b4494f2e6af28b]::gather_locals::GatherLocalsVisitor as rustc_hir[6af8095ba2ab9d73]::intravisit::Visitor>::visit_pat
  15:     0x74b2287e9e99 - <rustc_hir_typeck[69b4494f2e6af28b]::gather_locals::GatherLocalsVisitor as rustc_hir[6af8095ba2ab9d73]::intravisit::Visitor>::visit_pat
  16:     0x74b228fc9fcf - <rustc_hir_typeck[69b4494f2e6af28b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  17:     0x74b228661742 - <rustc_hir_typeck[69b4494f2e6af28b]::fn_ctxt::FnCtxt>::check_overloaded_binop
  18:     0x74b228fca185 - <rustc_hir_typeck[69b4494f2e6af28b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19:     0x74b224b599e3 - <rustc_hir_typeck[69b4494f2e6af28b]::fn_ctxt::FnCtxt>::check_expr_block
  20:     0x74b228fc87b7 - <rustc_hir_typeck[69b4494f2e6af28b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:     0x74b2287edca5 - rustc_hir_typeck[69b4494f2e6af28b]::check::check_fn
  22:     0x74b2287d8de7 - rustc_hir_typeck[69b4494f2e6af28b]::typeck_with_inspect::{closure#0}
  23:     0x74b2287d7ab6 - rustc_query_impl[6f0ca6887c150a69]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f0ca6887c150a69]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 8usize]>>
  24:     0x74b2287cc664 - rustc_query_system[48caa8a8a4cfcb68]::query::plumbing::try_execute_query::<rustc_query_impl[6f0ca6887c150a69]::DynamicConfig<rustc_data_structures[e24569e090b577b3]::vec_cache::VecCache<rustc_span[1f7aec696a0836ce]::def_id::LocalDefId, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[48caa8a8a4cfcb68]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[6f0ca6887c150a69]::plumbing::QueryCtxt, true>
  25:     0x74b2287c8608 - rustc_query_impl[6f0ca6887c150a69]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  26:     0x74b2287c774c - rustc_hir_analysis[5a87eb6962d34b42]::check_crate
  27:     0x74b228de0237 - rustc_interface[a43b584b4c4124b4]::passes::run_required_analyses
  28:     0x74b2292edb5e - rustc_interface[a43b584b4c4124b4]::passes::analysis
  29:     0x74b2292edb35 - rustc_query_impl[6f0ca6887c150a69]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f0ca6887c150a69]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 0usize]>>
  30:     0x74b2296aaf04 - rustc_query_system[48caa8a8a4cfcb68]::query::plumbing::try_execute_query::<rustc_query_impl[6f0ca6887c150a69]::DynamicConfig<rustc_query_system[48caa8a8a4cfcb68]::query::caches::SingleCache<rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[6f0ca6887c150a69]::plumbing::QueryCtxt, true>
  31:     0x74b2296aa828 - rustc_query_impl[6f0ca6887c150a69]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  32:     0x74b2295aa0c7 - rustc_interface[a43b584b4c4124b4]::passes::create_and_enter_global_ctxt::<core[105cb658ab12d76f]::option::Option<rustc_interface[a43b584b4c4124b4]::queries::Linker>, rustc_driver_impl[b7d73271a09ede7d]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  33:     0x74b2294fe966 - rustc_interface[a43b584b4c4124b4]::interface::run_compiler::<(), rustc_driver_impl[b7d73271a09ede7d]::run_compiler::{closure#0}>::{closure#1}
  34:     0x74b2294b523e - std[61bb86a81f0491]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a43b584b4c4124b4]::util::run_in_thread_with_globals<rustc_interface[a43b584b4c4124b4]::util::run_in_thread_pool_with_globals<rustc_interface[a43b584b4c4124b4]::interface::run_compiler<(), rustc_driver_impl[b7d73271a09ede7d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  35:     0x74b2294b56b4 - <<std[61bb86a81f0491]::thread::Builder>::spawn_unchecked_<rustc_interface[a43b584b4c4124b4]::util::run_in_thread_with_globals<rustc_interface[a43b584b4c4124b4]::util::run_in_thread_pool_with_globals<rustc_interface[a43b584b4c4124b4]::interface::run_compiler<(), rustc_driver_impl[b7d73271a09ede7d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[105cb658ab12d76f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x74b2294b6aab - std::sys::pal::unix::thread::Thread::new::thread_start::h1822d22fde68314f
  37:     0x74b2230a2ef1 - start_thread
                               at ./nptl/pthread_create.c:448:8
  38:     0x74b22313445c - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
  39:                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: rustc 1.88.0 (6b00bc388 2025-06-23) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [typeck] type-checking `foo`
#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/lib.rs:4:9
  |
4 |     p1? + p2?;
  |         ^
  |
note: delayed at compiler/rustc_hir_typeck/src/op.rs:1003:28 - disabled backtrace
 --> src/lib.rs:4:9
  |
4 |     p1? + p2?;
  |         ^

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:4 ~ iceostradd[016d]::foo).30) in DefId(0:4 ~ iceostradd[016d]::foo)
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^^
  |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^^

error: internal compiler error: `Option<&OsStr>` overridden by `Option<&OsStr>` for HirId(DefId(0:4 ~ iceostradd[016d]::foo).28) in DefId(0:4 ~ iceostradd[016d]::foo)
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^
  |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^

error: internal compiler error: `ControlFlow<Option<Infallible>, &OsStr>` overridden by `ControlFlow<Option<Infallible>, &OsStr>` for HirId(DefId(0:4 ~ iceostradd[016d]::foo).31) in DefId(0:4 ~ iceostradd[016d]::foo)
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^^
  |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28 - disabled backtrace
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^^

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 x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -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 `iceostradd` (lib)

Caused by:
  process didn't exit successfully: `/home/karenw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name iceostradd --edition=2024 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=179 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=73a0bd79c038c801 -C extra-filename=-1fddb91a960866c0 --out-dir /home/karenw/src/iceostradd/target/debug/deps -C incremental=/home/karenw/src/iceostradd/target/debug/incremental -L dependency=/home/karenw/src/iceostradd/target/debug/deps` (exit status: 101)
Backtrace

karenw@adrammelech:~/src/iceostradd$ RUST_BACKTRACE=1 cargo build
   Compiling iceostradd v0.1.0 (/home/karenw/src/iceostradd)

thread 'rustc' panicked at compiler/rustc_hir_typeck/src/gather_locals.rs:112:17:
assertion `left == right` failed
  left: Some(?32t)
 right: None
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<core::option::Option<rustc_middle::ty::Ty>, core::option::Option<rustc_middle::ty::Ty>>
   4: <rustc_hir_typeck::gather_locals::GatherLocalsVisitor as rustc_hir::intravisit::Visitor>::visit_pat
   5: <rustc_hir_typeck::gather_locals::GatherLocalsVisitor as rustc_hir::intravisit::Visitor>::visit_pat
   6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_overloaded_binop
   8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
  10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  11: rustc_hir_typeck::check::check_fn
  12: rustc_hir_typeck::typeck_with_inspect::{closure#0}
      [... omitted 1 frame ...]
  13: rustc_hir_analysis::check_crate
  14: rustc_interface::passes::run_required_analyses
  15: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  16: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  17: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [typeck] type-checking `foo`
#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/lib.rs:4:9
  |
4 |     p1? + p2?;
  |         ^
  |
note: delayed at compiler/rustc_hir_typeck/src/op.rs:1003:28
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
         4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_overloaded_binop
         5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
         7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         8: rustc_hir_typeck::check::check_fn
         9: rustc_hir_typeck::typeck_with_inspect::{closure#0}
        10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        12: rustc_query_impl::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
        13: rustc_hir_analysis::check_crate
        14: rustc_interface::passes::run_required_analyses
        15: rustc_interface::passes::analysis
        16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        18: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
        19: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
        20: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        21: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        22: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        23: std::sys::pal::unix::thread::Thread::new::thread_start
        24: start_thread
                   at ./nptl/pthread_create.c:448:8
        25: __GI___clone3
                   at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
 --> src/lib.rs:4:9
  |
4 |     p1? + p2?;
  |         ^

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:4 ~ iceostradd[016d]::foo).30) in DefId(0:4 ~ iceostradd[016d]::foo)
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^^
  |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_call
         6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_overloaded_binop
         9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
        10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
        11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
        12: rustc_hir_typeck::check::check_fn
        13: rustc_hir_typeck::typeck_with_inspect::{closure#0}
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        16: rustc_query_impl::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
        17: rustc_hir_analysis::check_crate
        18: rustc_interface::passes::run_required_analyses
        19: rustc_interface::passes::analysis
        20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        22: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
        23: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
        24: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        25: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        27: std::sys::pal::unix::thread::Thread::new::thread_start
        28: start_thread
                   at ./nptl/pthread_create.c:448:8
        29: __GI___clone3
                   at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^^

error: internal compiler error: `Option<&OsStr>` overridden by `Option<&OsStr>` for HirId(DefId(0:4 ~ iceostradd[016d]::foo).28) in DefId(0:4 ~ iceostradd[016d]::foo)
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^
  |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_call
         6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_overloaded_binop
         9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
        10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
        11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
        12: rustc_hir_typeck::check::check_fn
        13: rustc_hir_typeck::typeck_with_inspect::{closure#0}
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        16: rustc_query_impl::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
        17: rustc_hir_analysis::check_crate
        18: rustc_interface::passes::run_required_analyses
        19: rustc_interface::passes::analysis
        20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        22: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
        23: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
        24: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        25: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        27: std::sys::pal::unix::thread::Thread::new::thread_start
        28: start_thread
                   at ./nptl/pthread_create.c:448:8
        29: __GI___clone3
                   at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^

error: internal compiler error: `ControlFlow<Option<Infallible>, &OsStr>` overridden by `ControlFlow<Option<Infallible>, &OsStr>` for HirId(DefId(0:4 ~ iceostradd[016d]::foo).31) in DefId(0:4 ~ iceostradd[016d]::foo)
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^^
  |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:159:28
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_overloaded_binop
         7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
         9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
        10: rustc_hir_typeck::check::check_fn
        11: rustc_hir_typeck::typeck_with_inspect::{closure#0}
        12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        14: rustc_query_impl::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
        15: rustc_hir_analysis::check_crate
        16: rustc_interface::passes::run_required_analyses
        17: rustc_interface::passes::analysis
        18: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        20: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
        21: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
        22: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        23: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        24: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        25: std::sys::pal::unix::thread::Thread::new::thread_start
        26: start_thread
                   at ./nptl/pthread_create.c:448:8
        27: __GI___clone3
                   at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
 --> src/lib.rs:4:11
  |
4 |     p1? + p2?;
  |           ^^^

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 x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -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 `iceostradd` (lib)

Caused by:
  process didn't exit successfully: `/home/karenw/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name iceostradd --edition=2024 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=179 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=73a0bd79c038c801 -C extra-filename=-1fddb91a960866c0 --out-dir /home/karenw/src/iceostradd/target/debug/deps -C incremental=/home/karenw/src/iceostradd/target/debug/incremental -L dependency=/home/karenw/src/iceostradd/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