Skip to content

ICE during mir inlining: None in compiler/rustc_mir_transform/src/inline.rs:185:32 #98821

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

code from ./src/test/ui/abi/rustcall-generic.rs

// check-pass
#![feature(unboxed_closures)]

extern "rust-call" fn foo<T>(_: T) {}

fn main() {
    foo(());
    foo((1, 2));
}

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (6a1092056 2022-07-02)
binary: rustc
commit-hash: 6a1092056441652fe5fe5c5b422644951e6b99ce
commit-date: 2022-07-02
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

Error output

rustc ./src/test/ui/abi/rustcall-generic.rs -Zmir-opt-level=3

Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_mir_transform/src/inline.rs:185:32
stack backtrace:
   0:     0x7fc9952a1b00 - std::backtrace_rs::backtrace::libunwind::trace::h5f5188fd44a6fa3f
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fc9952a1b00 - std::backtrace_rs::backtrace::trace_unsynchronized::h86acd9922721a5e8
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc9952a1b00 - std::sys_common::backtrace::_print_fmt::h83b7a5cc988df184
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fc9952a1b00 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h42f81a29efffa7fc
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fc9952fa83c - core::fmt::write::hc61920cc0add5157
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/core/src/fmt/mod.rs:1198:17
   5:     0x7fc9952932a5 - std::io::Write::write_fmt::hf47f0f4d2a31f9bb
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/io/mod.rs:1672:15
   6:     0x7fc9952a46f1 - std::sys_common::backtrace::_print::hea15abfb5e8e9a7e
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fc9952a46f1 - std::sys_common::backtrace::print::h926cdc931f11747b
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fc9952a46f1 - std::panicking::default_hook::{{closure}}::h24e1a4c029e18db8
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/panicking.rs:295:22
   9:     0x7fc9952a43c3 - std::panicking::default_hook::hbb28271922950e54
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/panicking.rs:314:9
  10:     0x7fc995b3f7c4 - rustc_driver[7b6a9f3676637733]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fc9952a4ec6 - std::panicking::rust_panic_with_hook::h073e22e6c5e7eea4
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/panicking.rs:702:17
  12:     0x7fc9952a4cd9 - std::panicking::begin_panic_handler::{{closure}}::h8f91eed85d476314
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/panicking.rs:586:13
  13:     0x7fc9952a1fd4 - std::sys_common::backtrace::__rust_end_short_backtrace::hf913905a5f635a37
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7fc9952a4a42 - rust_begin_unwind
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/panicking.rs:584:5
  15:     0x7fc9952698c3 - core::panicking::panic_fmt::h792cbb1e1889f5b9
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/core/src/panicking.rs:142:14
  16:     0x7fc99526978d - core::panicking::panic::h373dc88281460d29
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/core/src/panicking.rs:48:5
  17:     0x7fc996feca2f - <rustc_mir_transform[bc00b0b3c09f4f08]::inline::Inliner>::try_inlining
  18:     0x7fc996fe7b67 - <rustc_mir_transform[bc00b0b3c09f4f08]::inline::Inliner>::process_blocks
  19:     0x7fc997e5f666 - <rustc_mir_transform[bc00b0b3c09f4f08]::inline::Inline as rustc_middle[c8545dd26ffcba5]::mir::MirPass>::run_pass
  20:     0x7fc996f5417a - rustc_mir_transform[bc00b0b3c09f4f08]::pass_manager::run_passes
  21:     0x7fc996fc2d1b - rustc_mir_transform[bc00b0b3c09f4f08]::optimized_mir
  22:     0x7fc9976bf0f6 - rustc_query_system[879006cf2a42a665]::query::plumbing::try_execute_query::<rustc_query_impl[852b541d10ccc678]::plumbing::QueryCtxt, rustc_query_system[879006cf2a42a665]::query::caches::DefaultCache<rustc_span[e607adc38c66cc9c]::def_id::DefId, &rustc_middle[c8545dd26ffcba5]::mir::Body>>
  23:     0x7fc997693d9e - <rustc_query_impl[852b541d10ccc678]::Queries as rustc_middle[c8545dd26ffcba5]::ty::query::QueryEngine>::optimized_mir
  24:     0x7fc997b859bc - <rustc_middle[c8545dd26ffcba5]::ty::context::TyCtxt>::instance_mir
  25:     0x7fc996f1dc8c - rustc_monomorphize[373dc5a4604c64f1]::collector::collect_neighbours
  26:     0x7fc996f1b6a3 - rustc_monomorphize[373dc5a4604c64f1]::collector::collect_items_rec
  27:     0x7fc997e203ce - <rustc_session[c3981ce6ea84848f]::session::Session>::time::<(), rustc_monomorphize[373dc5a4604c64f1]::collector::collect_crate_mono_items::{closure#1}>
  28:     0x7fc997e1438b - rustc_monomorphize[373dc5a4604c64f1]::collector::collect_crate_mono_items
  29:     0x7fc997e22256 - rustc_monomorphize[373dc5a4604c64f1]::partitioning::collect_and_partition_mono_items
  30:     0x7fc9981f6c31 - rustc_query_system[879006cf2a42a665]::query::plumbing::try_execute_query::<rustc_query_impl[852b541d10ccc678]::plumbing::QueryCtxt, rustc_query_system[879006cf2a42a665]::query::caches::DefaultCache<(), (&std[2b240f46076710c2]::collections::hash::set::HashSet<rustc_span[e607adc38c66cc9c]::def_id::DefId, core[14fb25f864271e3d]::hash::BuildHasherDefault<rustc_hash[608fda000a437368]::FxHasher>>, &[rustc_middle[c8545dd26ffcba5]::mir::mono::CodegenUnit])>>
  31:     0x7fc998245640 - rustc_query_system[879006cf2a42a665]::query::plumbing::get_query::<rustc_query_impl[852b541d10ccc678]::queries::collect_and_partition_mono_items, rustc_query_impl[852b541d10ccc678]::plumbing::QueryCtxt>
  32:     0x7fc998197482 - <rustc_query_impl[852b541d10ccc678]::Queries as rustc_middle[c8545dd26ffcba5]::ty::query::QueryEngine>::collect_and_partition_mono_items
  33:     0x7fc997cfe2d6 - rustc_codegen_ssa[f4ef7e837cfce537]::base::codegen_crate::<rustc_codegen_llvm[3c483c3e160e33a5]::LlvmCodegenBackend>
  34:     0x7fc997d58faa - <rustc_codegen_llvm[3c483c3e160e33a5]::LlvmCodegenBackend as rustc_codegen_ssa[f4ef7e837cfce537]::traits::backend::CodegenBackend>::codegen_crate
  35:     0x7fc997cc7797 - <rustc_session[c3981ce6ea84848f]::session::Session>::time::<alloc[d085c844073e7148]::boxed::Box<dyn core[14fb25f864271e3d]::any::Any>, rustc_interface[9432e52dc13d788b]::passes::start_codegen::{closure#0}>
  36:     0x7fc997cb4da0 - <rustc_interface[9432e52dc13d788b]::passes::QueryContext>::enter::<<rustc_interface[9432e52dc13d788b]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[14fb25f864271e3d]::result::Result<alloc[d085c844073e7148]::boxed::Box<dyn core[14fb25f864271e3d]::any::Any>, rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>>
  37:     0x7fc997cbea83 - <rustc_interface[9432e52dc13d788b]::queries::Queries>::ongoing_codegen
  38:     0x7fc997c80941 - <rustc_interface[9432e52dc13d788b]::interface::Compiler>::enter::<rustc_driver[7b6a9f3676637733]::run_compiler::{closure#1}::{closure#2}, core[14fb25f864271e3d]::result::Result<core[14fb25f864271e3d]::option::Option<rustc_interface[9432e52dc13d788b]::queries::Linker>, rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>>
  39:     0x7fc997c7cb10 - rustc_span[e607adc38c66cc9c]::with_source_map::<core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>, rustc_interface[9432e52dc13d788b]::interface::create_compiler_and_run<core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>, rustc_driver[7b6a9f3676637733]::run_compiler::{closure#1}>::{closure#1}>
  40:     0x7fc997c97152 - rustc_interface[9432e52dc13d788b]::interface::create_compiler_and_run::<core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>, rustc_driver[7b6a9f3676637733]::run_compiler::{closure#1}>
  41:     0x7fc997c7c312 - <scoped_tls[70eeb41b45557dfc]::ScopedKey<rustc_span[e607adc38c66cc9c]::SessionGlobals>>::set::<rustc_interface[9432e52dc13d788b]::interface::run_compiler<core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>, rustc_driver[7b6a9f3676637733]::run_compiler::{closure#1}>::{closure#0}, core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>>
  42:     0x7fc997c7f02f - std[2b240f46076710c2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9432e52dc13d788b]::util::run_in_thread_pool_with_globals<rustc_interface[9432e52dc13d788b]::interface::run_compiler<core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>, rustc_driver[7b6a9f3676637733]::run_compiler::{closure#1}>::{closure#0}, core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>>::{closure#0}, core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>>
  43:     0x7fc997c97599 - <<std[2b240f46076710c2]::thread::Builder>::spawn_unchecked_<rustc_interface[9432e52dc13d788b]::util::run_in_thread_pool_with_globals<rustc_interface[9432e52dc13d788b]::interface::run_compiler<core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>, rustc_driver[7b6a9f3676637733]::run_compiler::{closure#1}>::{closure#0}, core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>>::{closure#0}, core[14fb25f864271e3d]::result::Result<(), rustc_errors[6ee1132a2943978d]::ErrorGuaranteed>>::{closure#1} as core[14fb25f864271e3d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7fc9952ae823 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc0d6e5c13e25f3ac
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/alloc/src/boxed.rs:1951:9
  45:     0x7fc9952ae823 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd2ed52de3a2c31ce
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/alloc/src/boxed.rs:1951:9
  46:     0x7fc9952ae823 - std::sys::unix::thread::Thread::new::thread_start::h67c3209ce8692022
                               at /rustc/6a1092056441652fe5fe5c5b422644951e6b99ce/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7fc99508054d - <unknown>
  48:     0x7fc995105874 - clone
  49:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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.64.0-nightly (6a1092056 2022-07-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3

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

cc #91743 cc #81567

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-mir-opt-inliningArea: MIR inliningC-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.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions