Skip to content

Broken MIR in DropGlue, Transmute is not supported in non-runtime phase Analysis(PostCleanup) #139698

Description

@saethlin

I'm seeing the same ICE in about 70 crates. I should really build in some system to find the smallest one.

One of them that looks decently small is https://github.com/vmenge/speare, on commit 87f6a29f91ca60f17d6f9ed5757280a3bf73ffea if I run RUSTFLAGS=-Zvalidate-mir cargo +nightly build --tests I will get this ICE:

thread 'rustc' panicked at compiler/rustc_mir_transform/src/validate.rs:80:25:
broken MIR in DropGlue(DefId(2:2919 ~ core[74f8]::ptr::drop_in_place), Some(Coroutine(DefId(22:235 ~ speare[6d99]::spawn::{closure#0}), [one_for_all::Dad, one_for_all::Dad, (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(22:235 ~ speare[6d99]::spawn::{closure#0}), [one_for_all::Dad, one_for_all::Dad]), (std::option::Option<std::time::Duration>, speare::Ctx<one_for_all::Dad>)]))) (after pass MentionedItems) at bb191[0]:
Transmute is not supported in non-runtime phase Analysis(PostCleanup).
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_mir_transform::validate::CfgChecker>::fail::<alloc::string::String>
   3: <rustc_mir_transform::validate::Validator as rustc_mir_transform::pass_manager::MirPass>::run_pass
   4: rustc_mir_transform::pass_manager::validate_body
   5: rustc_mir_transform::pass_manager::run_passes_inner
   6: rustc_mir_transform::shim::make_shim
      [... omitted 3 frames ...]
   7: <rustc_middle::ty::context::TyCtxt>::instance_mir
   8: rustc_monomorphize::mono_checks::check_mono_item
      [... omitted 1 frame ...]
   9: rustc_monomorphize::collector::items_of_instance
      [... omitted 1 frame ...]
  10: rustc_monomorphize::collector::collect_items_rec::{closure#0}
  11: rustc_monomorphize::collector::collect_items_rec
  12: rustc_monomorphize::collector::collect_items_rec
  13: rustc_monomorphize::collector::collect_items_rec
  14: rustc_monomorphize::collector::collect_items_rec
  15: rustc_monomorphize::collector::collect_items_rec
  16: rustc_monomorphize::collector::collect_items_rec
  17: rustc_monomorphize::collector::collect_items_rec
  18: rustc_monomorphize::collector::collect_items_rec
  19: rustc_monomorphize::collector::collect_items_rec
  20: rustc_monomorphize::collector::collect_items_rec
  21: rustc_monomorphize::partitioning::collect_and_partition_mono_items
      [... omitted 2 frames ...]
  22: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  23: <rustc_interface::queries::Linker>::codegen_and_build_linker
  24: 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}
  25: 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: please make sure that you have updated to the latest nightly

note: rustc 1.88.0-nightly (d2b3dd7c1 2025-04-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -Z validate-mir

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

query stack during panic:
#0 [mir_shims] generating MIR shim for `core::ptr::drop_in_place`
#1 [check_mono_item] monomorphization-time checking
#2 [items_of_instance] collecting items used by `core::ptr::drop_in_place::<{async block@speare::spawn<one_for_all::Dad, one_for_all::Dad>::{closure#0}}> - shim(Some({async block@speare::spawn<one_for_all::Dad, one_for_all::Dad>::{closure#0}}))`
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack

Activity

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

    -Zvalidate-mirUnstable option: MIR validationA-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-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