Skip to content

ICE: realtime sanitizer: bug!() #148750

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#[sanitize(realtime = "nonblocking")]
fn main() {
    #[sanitize()]
    || 0
}

original:

#![feature(sanitize)]
#[sanitize(realtime = "nonblocking")]
fn main() {
    #[sanitize()]
    || 0
}

Version information

rustc 1.93.0-nightly (20f1c045c 2025-11-09)
binary: rustc
commit-hash: 20f1c045c46aecba6a6aeda55fe6659b26871c87
commit-date: 2025-11-09
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.3

Possibly related line of code:

}
fn coroutine_for_closure(tcx: TyCtxt<'_>, def_id: LocalDefId) -> DefId {
let &rustc_hir::Closure { kind: hir::ClosureKind::CoroutineClosure(_), body, .. } =
tcx.hir_node_by_def_id(def_id).expect_closure()
else {
bug!()
};
let &hir::Expr {
kind:
hir::ExprKind::Closure(&rustc_hir::Closure {
def_id,

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

Program output

error[E0658]: the `#[sanitize]` attribute is an experimental feature
 --> /tmp/icemaker_global_tempdir.fhvsYFFuJxM6/rustc_testrunner_tmpdir_reporting.6jARXQkt7wHO/mvce.rs:1:1
  |
1 | #[sanitize(realtime = "nonblocking")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #39699 <https://github.com/rust-lang/rust/issues/39699> for more information
  = help: add `#![feature(sanitize)]` to the crate attributes to enable
  = note: this compiler was built on 2025-11-09; consider upgrading it if it is out of date

error[E0658]: the `#[sanitize]` attribute is an experimental feature
 --> /tmp/icemaker_global_tempdir.fhvsYFFuJxM6/rustc_testrunner_tmpdir_reporting.6jARXQkt7wHO/mvce.rs:3:5
  |
3 |     #[sanitize()]
  |     ^^^^^^^^^^^^^
  |
  = note: see issue #39699 <https://github.com/rust-lang/rust/issues/39699> for more information
  = help: add `#![feature(sanitize)]` to the crate attributes to enable
  = note: this compiler was built on 2025-11-09; consider upgrading it if it is out of date

error: internal compiler error: compiler/rustc_hir_analysis/src/collect.rs:1498:9: impossible case reached


thread 'rustc' (4069146) panicked at compiler/rustc_hir_analysis/src/collect.rs:1498:9:
Box<dyn Any>
stack backtrace:
   0:     0x7f00e246f3f3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h70ead4a450ff85a2
   1:     0x7f00e2c01afc - core::fmt::write::h40451427045f5a79
   2:     0x7f00e2423e33 - std::io::Write::write_fmt::haca497cd3e0e4636
   3:     0x7f00e2435442 - std::sys::backtrace::BacktraceLock::print::he3b7dc700f5c2baf
   4:     0x7f00e243b5d9 - std::panicking::default_hook::{{closure}}::h0194cd6368125a02
   5:     0x7f00e243b103 - std::panicking::default_hook::h1e496835bf013cc0
   6:     0x7f00e142cf91 - std[fc5f784c9d0c2171]::panicking::update_hook::<alloc[3541db5a9ffe35ba]::boxed::Box<rustc_driver_impl[8f40c20ecf8d733e]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7f00e243b9ff - std::panicking::panic_with_hook::hdf6d4e15c008aa49
   8:     0x7f00e1468eb1 - std[fc5f784c9d0c2171]::panicking::begin_panic::<rustc_errors[415ec6bff4cfa230]::ExplicitBug>::{closure#0}
   9:     0x7f00e145b706 - std[fc5f784c9d0c2171]::sys::backtrace::__rust_end_short_backtrace::<std[fc5f784c9d0c2171]::panicking::begin_panic<rustc_errors[415ec6bff4cfa230]::ExplicitBug>::{closure#0}, !>
  10:     0x7f00e145b347 - std[fc5f784c9d0c2171]::panicking::begin_panic::<rustc_errors[415ec6bff4cfa230]::ExplicitBug>
  11:     0x7f00e1487521 - <rustc_errors[415ec6bff4cfa230]::diagnostic::BugAbort as rustc_errors[415ec6bff4cfa230]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7f00e1a101ba - rustc_middle[5a8ffef956340c0e]::util::bug::opt_span_bug_fmt::<rustc_span[62b11896fea64ffa]::span_encoding::Span>::{closure#0}
  13:     0x7f00e1a1033a - rustc_middle[5a8ffef956340c0e]::ty::context::tls::with_opt::<rustc_middle[5a8ffef956340c0e]::util::bug::opt_span_bug_fmt<rustc_span[62b11896fea64ffa]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f00e1a00d4b - rustc_middle[5a8ffef956340c0e]::ty::context::tls::with_context_opt::<rustc_middle[5a8ffef956340c0e]::ty::context::tls::with_opt<rustc_middle[5a8ffef956340c0e]::util::bug::opt_span_bug_fmt<rustc_span[62b11896fea64ffa]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f00df7a03e0 - rustc_middle[5a8ffef956340c0e]::util::bug::bug_fmt
  16:     0x7f00e15dc847 - rustc_hir_analysis[dbc54fc37a4aacb7]::collect::coroutine_for_closure
  17:     0x7f00e1e0eebc - rustc_query_impl[33db1c0a85c9085b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33db1c0a85c9085b]::query_impl::coroutine_for_closure::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 8usize]>>
  18:     0x7f00e2c1c5c6 - rustc_query_system[9a539d2db6e682d0]::query::plumbing::try_execute_query::<rustc_query_impl[33db1c0a85c9085b]::DynamicConfig<rustc_query_system[9a539d2db6e682d0]::query::caches::DefIdCache<rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[33db1c0a85c9085b]::plumbing::QueryCtxt, false>
  19:     0x7f00e1eac798 - rustc_query_impl[33db1c0a85c9085b]::query_impl::coroutine_for_closure::get_query_non_incr::__rust_end_short_backtrace
  20:     0x7f00e37cdbf9 - rustc_codegen_ssa[5514846d01f84698]::codegen_attrs::codegen_fn_attrs
  21:     0x7f00e37ca4ee - rustc_query_impl[33db1c0a85c9085b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33db1c0a85c9085b]::query_impl::codegen_fn_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7f00e2c1c5c6 - rustc_query_system[9a539d2db6e682d0]::query::plumbing::try_execute_query::<rustc_query_impl[33db1c0a85c9085b]::DynamicConfig<rustc_query_system[9a539d2db6e682d0]::query::caches::DefIdCache<rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[33db1c0a85c9085b]::plumbing::QueryCtxt, false>
  23:     0x7f00e2c1be9d - rustc_query_impl[33db1c0a85c9085b]::query_impl::codegen_fn_attrs::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7f00e33eab28 - rustc_hir_analysis[dbc54fc37a4aacb7]::check::check::check_item_type
  25:     0x7f00e33e5e5c - rustc_hir_analysis[dbc54fc37a4aacb7]::check::wfcheck::check_well_formed
  26:     0x7f00e33e5e35 - rustc_query_impl[33db1c0a85c9085b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33db1c0a85c9085b]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 1usize]>>
  27:     0x7f00e33e56ac - rustc_query_system[9a539d2db6e682d0]::query::plumbing::try_execute_query::<rustc_query_impl[33db1c0a85c9085b]::DynamicConfig<rustc_data_structures[84a601b57cb32483]::vec_cache::VecCache<rustc_span[62b11896fea64ffa]::def_id::LocalDefId, rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[9a539d2db6e682d0]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[33db1c0a85c9085b]::plumbing::QueryCtxt, false>
  28:     0x7f00e33e51c2 - rustc_query_impl[33db1c0a85c9085b]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7f00e33e2778 - rustc_hir_analysis[dbc54fc37a4aacb7]::check::wfcheck::check_type_wf
  30:     0x7f00e33e261d - rustc_query_impl[33db1c0a85c9085b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33db1c0a85c9085b]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7f00e3c4d148 - rustc_query_system[9a539d2db6e682d0]::query::plumbing::try_execute_query::<rustc_query_impl[33db1c0a85c9085b]::DynamicConfig<rustc_query_system[9a539d2db6e682d0]::query::caches::SingleCache<rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[33db1c0a85c9085b]::plumbing::QueryCtxt, false>
  32:     0x7f00e3c4cf0e - rustc_query_impl[33db1c0a85c9085b]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f00e37cf5fa - rustc_hir_analysis[dbc54fc37a4aacb7]::check_crate
  34:     0x7f00e2ef1830 - rustc_interface[8e920020efb26e23]::passes::analysis
  35:     0x7f00e2ef14e5 - rustc_query_impl[33db1c0a85c9085b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33db1c0a85c9085b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 0usize]>>
  36:     0x7f00e3c53d5a - rustc_query_system[9a539d2db6e682d0]::query::plumbing::try_execute_query::<rustc_query_impl[33db1c0a85c9085b]::DynamicConfig<rustc_query_system[9a539d2db6e682d0]::query::caches::SingleCache<rustc_middle[5a8ffef956340c0e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[33db1c0a85c9085b]::plumbing::QueryCtxt, false>
  37:     0x7f00e3c53990 - rustc_query_impl[33db1c0a85c9085b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f00e3e7204a - <rustc_interface[8e920020efb26e23]::passes::create_and_enter_global_ctxt<core[690118bff76d9d00]::option::Option<rustc_interface[8e920020efb26e23]::queries::Linker>, rustc_driver_impl[8f40c20ecf8d733e]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[690118bff76d9d00]::ops::function::FnOnce<(&rustc_session[2af9fa06999f05b1]::session::Session, rustc_middle[5a8ffef956340c0e]::ty::context::CurrentGcx, alloc[3541db5a9ffe35ba]::sync::Arc<rustc_data_structures[84a601b57cb32483]::jobserver::Proxy>, &std[fc5f784c9d0c2171]::sync::once_lock::OnceLock<rustc_middle[5a8ffef956340c0e]::ty::context::GlobalCtxt>, &rustc_data_structures[84a601b57cb32483]::sync::worker_local::WorkerLocal<rustc_middle[5a8ffef956340c0e]::arena::Arena>, &rustc_data_structures[84a601b57cb32483]::sync::worker_local::WorkerLocal<rustc_hir[75b1dc330fdf77dd]::Arena>, rustc_driver_impl[8f40c20ecf8d733e]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  39:     0x7f00e3d392a9 - rustc_interface[8e920020efb26e23]::interface::run_compiler::<(), rustc_driver_impl[8f40c20ecf8d733e]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7f00e3d1cac7 - std[fc5f784c9d0c2171]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8e920020efb26e23]::util::run_in_thread_with_globals<rustc_interface[8e920020efb26e23]::util::run_in_thread_pool_with_globals<rustc_interface[8e920020efb26e23]::interface::run_compiler<(), rustc_driver_impl[8f40c20ecf8d733e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  41:     0x7f00e3d1c7a8 - <<std[fc5f784c9d0c2171]::thread::Builder>::spawn_unchecked_<rustc_interface[8e920020efb26e23]::util::run_in_thread_with_globals<rustc_interface[8e920020efb26e23]::util::run_in_thread_pool_with_globals<rustc_interface[8e920020efb26e23]::interface::run_compiler<(), rustc_driver_impl[8f40c20ecf8d733e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[690118bff76d9d00]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f00e3d229af - std::sys::thread::unix::Thread::new::thread_start::h2d1501518603062e
  43:     0x7f00dd4969cb - <unknown>
  44:     0x7f00dd51aa0c - <unknown>
  45:                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.93.0-nightly (20f1c045c 2025-11-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [coroutine_for_closure] Given a coroutine-closure def id, return the def id of the coroutine returned by it
#1 [codegen_fn_attrs] computing codegen attributes of `main::{closure#0}`
#2 [check_well_formed] checking that `main::{closure#0}` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.

@rustbot label +F-sanitize

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-coroutinesArea: CoroutinesA-sanitizersArea: Sanitizers for correctness and code qualityC-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