Skip to content

internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available for DefId #115052

Closed
@ctz

Description

@ctz

Code

Sorry, haven't tried to minimise this yet. The repro steps are here:

$ git clone https://github.com/ctz/rustls-experimental.git --branch jbp-generalise-crypto-usage-pt2-ice
$ cd rustls-experimental/
$ cargo +stable test --features secret_extraction
(normal crate compiling output...)
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available for DefId(20:1808 ~ rustls[ff5a]::tls13::chacha20_poly1305_extract_keys)
(see full error output below...)

Meta

rustc --version --verbose:

rustc 1.71.1 (eb26296b5 2023-08-03)

Also reproduces in rustc 1.74.0-nightly (5c6a7e71c 2023-08-20)

Error output

   Compiling rustls v0.22.0-alpha.0 (/home/jbp/rustls/rustls)
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available for DefId(20:1808 ~ rustls[b796]::tls13::chacha20_poly1305_extract_keys)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/compiler/rustc_errors/src/lib.rs:1651:9
stack backtrace:
   0:     0x7f9ab9475071 - std::backtrace_rs::backtrace::libunwind::trace::h782cc21a5acaf6cb
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9ab9475071 - std::backtrace_rs::backtrace::trace_unsynchronized::hc579eb24ab204515
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9ab9475071 - std::sys_common::backtrace::_print_fmt::h7223525cfdbacda2
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9ab9475071 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbd7d55b7108d2ab8
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9ab94d4d9f - core::fmt::rt::Argument::fmt::hb4f4a02b9bd9dd49
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/fmt/rt.rs:138:9
   5:     0x7f9ab94d4d9f - core::fmt::write::h6d54cd7c9e155ec5
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f9ab9468311 - std::io::Write::write_fmt::h6a453a71c692f63b
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/io/mod.rs:1713:15
   7:     0x7f9ab9474e85 - std::sys_common::backtrace::_print::h1cbaa8b42678f928
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9ab9474e85 - std::sys_common::backtrace::print::h4ddf81241a51b337
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9ab9477b47 - std::panicking::default_hook::{{closure}}::hff91f1f484ade5cd
  10:     0x7f9ab9477934 - std::panicking::default_hook::h21f14afd59f7aef9
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:288:9
  11:     0x7f9ab82f70cb - <rustc_driver_impl[a4629e012e48ffc1]::install_ice_hook::{closure#0} as core[95ee2d8017598cc7]::ops::function::FnOnce<(&core[95ee2d8017598cc7]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f9ab947828d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::ha1f76bdae3c27ab6
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/boxed.rs:1999:9
  13:     0x7f9ab947828d - std::panicking::rust_panic_with_hook::h45f66047b14c555c
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:709:13
  14:     0x7f9ab8801951 - std[edecf719d62c0e6b]::panicking::begin_panic::<rustc_errors[f0469ee7e5c3d3ff]::ExplicitBug>::{closure#0}
  15:     0x7f9ab87fd976 - std[edecf719d62c0e6b]::sys_common::backtrace::__rust_end_short_backtrace::<std[edecf719d62c0e6b]::panicking::begin_panic<rustc_errors[f0469ee7e5c3d3ff]::ExplicitBug>::{closure#0}, !>
  16:     0x7f9ab87fd136 - std[edecf719d62c0e6b]::panicking::begin_panic::<rustc_errors[f0469ee7e5c3d3ff]::ExplicitBug>
  17:     0x7f9ab87f6d94 - <rustc_errors[f0469ee7e5c3d3ff]::HandlerInner>::bug::<alloc[dfb0c3e97fe8b89b]::string::String>
  18:     0x7f9ab87f6b36 - <rustc_errors[f0469ee7e5c3d3ff]::Handler>::bug::<alloc[dfb0c3e97fe8b89b]::string::String>
  19:     0x7f9ab8884fac - rustc_middle[c682e143f9d710c7]::util::bug::opt_span_bug_fmt::<rustc_span[c2ff3b0962b898e5]::span_encoding::Span>::{closure#0}
  20:     0x7f9ab888167a - rustc_middle[c682e143f9d710c7]::ty::context::tls::with_opt::<rustc_middle[c682e143f9d710c7]::util::bug::opt_span_bug_fmt<rustc_span[c2ff3b0962b898e5]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f9ab888164a - rustc_middle[c682e143f9d710c7]::ty::context::tls::with_context_opt::<rustc_middle[c682e143f9d710c7]::ty::context::tls::with_opt<rustc_middle[c682e143f9d710c7]::util::bug::opt_span_bug_fmt<rustc_span[c2ff3b0962b898e5]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9ab69ba1dd - rustc_middle[c682e143f9d710c7]::util::bug::bug_fmt
  23:     0x7f9ab72d8beb - rustc_monomorphize[9472dad9f96b1e7f]::collector::should_codegen_locally
  24:     0x7f9ab71e506b - rustc_monomorphize[9472dad9f96b1e7f]::collector::collect_miri
  25:     0x7f9ab71e4ff7 - rustc_monomorphize[9472dad9f96b1e7f]::collector::collect_miri
  26:     0x7f9ab71e4ff7 - rustc_monomorphize[9472dad9f96b1e7f]::collector::collect_miri
  27:     0x7f9ab71e4ff7 - rustc_monomorphize[9472dad9f96b1e7f]::collector::collect_miri
  28:     0x7f9ab71cd527 - rustc_monomorphize[9472dad9f96b1e7f]::collector::collect_items_rec
  29:     0x7f9ab76bace7 - rustc_data_structures[8548742d45a93e9b]::sync::par_for_each_in::<alloc[dfb0c3e97fe8b89b]::vec::Vec<rustc_middle[c682e143f9d710c7]::mir::mono::MonoItem>, rustc_monomorphize[9472dad9f96b1e7f]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  30:     0x7f9ab76ba9a0 - <rustc_session[b7d9e6f930bc0bce]::session::Session>::time::<(), rustc_monomorphize[9472dad9f96b1e7f]::collector::collect_crate_mono_items::{closure#1}>
  31:     0x7f9ab76ba5c0 - rustc_monomorphize[9472dad9f96b1e7f]::collector::collect_crate_mono_items
  32:     0x7f9ab76b89a7 - rustc_monomorphize[9472dad9f96b1e7f]::partitioning::collect_and_partition_mono_items
  33:     0x7f9ab79055b9 - rustc_query_impl[6e478c483b869c25]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6e478c483b869c25]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c682e143f9d710c7]::query::erase::Erased<[u8; 24usize]>>
  34:     0x7f9ab790558b - <rustc_query_impl[6e478c483b869c25]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[95ee2d8017598cc7]::ops::function::FnOnce<(rustc_middle[c682e143f9d710c7]::ty::context::TyCtxt, ())>>::call_once
  35:     0x7f9ab7b3ce42 - rustc_query_system[93b6edfdc601e81a]::query::plumbing::try_execute_query::<rustc_query_impl[6e478c483b869c25]::DynamicConfig<rustc_query_system[93b6edfdc601e81a]::query::caches::SingleCache<rustc_middle[c682e143f9d710c7]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[6e478c483b869c25]::plumbing::QueryCtxt, true>
  36:     0x7f9ab7b3c9e6 - rustc_query_impl[6e478c483b869c25]::query_impl::collect_and_partition_mono_items::get_query_incr::__rust_end_short_backtrace
  37:     0x7f9ab793c769 - rustc_codegen_ssa[b3c509f34a4358db]::base::codegen_crate::<rustc_codegen_llvm[6b638aae027b3fd2]::LlvmCodegenBackend>
  38:     0x7f9ab793c54b - <rustc_codegen_llvm[6b638aae027b3fd2]::LlvmCodegenBackend as rustc_codegen_ssa[b3c509f34a4358db]::traits::backend::CodegenBackend>::codegen_crate
  39:     0x7f9ab75560a2 - <rustc_session[b7d9e6f930bc0bce]::session::Session>::time::<alloc[dfb0c3e97fe8b89b]::boxed::Box<dyn core[95ee2d8017598cc7]::any::Any>, rustc_interface[c65fde630b50e8]::passes::start_codegen::{closure#0}>
  40:     0x7f9ab7555beb - rustc_interface[c65fde630b50e8]::passes::start_codegen
  41:     0x7f9ab7553cdd - <rustc_middle[c682e143f9d710c7]::ty::context::GlobalCtxt>::enter::<<rustc_interface[c65fde630b50e8]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[95ee2d8017598cc7]::result::Result<alloc[dfb0c3e97fe8b89b]::boxed::Box<dyn core[95ee2d8017598cc7]::any::Any>, rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>
  42:     0x7f9ab7551e8d - <rustc_interface[c65fde630b50e8]::queries::Queries>::ongoing_codegen
  43:     0x7f9ab75514a9 - <rustc_interface[c65fde630b50e8]::interface::Compiler>::enter::<rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}::{closure#2}, core[95ee2d8017598cc7]::result::Result<core[95ee2d8017598cc7]::option::Option<rustc_interface[c65fde630b50e8]::queries::Linker>, rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>
  44:     0x7f9ab754f5c4 - rustc_span[c2ff3b0962b898e5]::set_source_map::<core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>, rustc_interface[c65fde630b50e8]::interface::run_compiler<core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  45:     0x7f9ab754f1a1 - <scoped_tls[24938f349c8d16f0]::ScopedKey<rustc_span[c2ff3b0962b898e5]::SessionGlobals>>::set::<rustc_interface[c65fde630b50e8]::interface::run_compiler<core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}>::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>
  46:     0x7f9ab754e796 - std[edecf719d62c0e6b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c65fde630b50e8]::util::run_in_thread_pool_with_globals<rustc_interface[c65fde630b50e8]::interface::run_compiler<core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}>::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>
  47:     0x7f9ab7ba64c5 - <<std[edecf719d62c0e6b]::thread::Builder>::spawn_unchecked_<rustc_interface[c65fde630b50e8]::util::run_in_thread_pool_with_globals<rustc_interface[c65fde630b50e8]::interface::run_compiler<core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>, rustc_driver_impl[a4629e012e48ffc1]::run_compiler::{closure#1}>::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[95ee2d8017598cc7]::result::Result<(), rustc_span[c2ff3b0962b898e5]::ErrorGuaranteed>>::{closure#1} as core[95ee2d8017598cc7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f9ab94827b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he3e5dbdfabe0b668
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/boxed.rs:1985:9
  49:     0x7f9ab94827b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h246f7c7964633611
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/boxed.rs:1985:9
  50:     0x7f9ab94827b5 - std::sys::unix::thread::Thread::new::thread_start::hadf9e3501ff0df23
                               at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys/unix/thread.rs:108:17
  51:     0x7f9ab4e94b43 - start_thread
                               at ./nptl/pthread_create.c:442:8
  52:     0x7f9ab4f26a00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  53:                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: rustc 1.71.1 (eb26296b5 2023-08-03) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -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 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `rustls` (example "bench")
Backtrace

$ RUST_BACKTRACE=1 cargo +stable test --features secret_extraction
   Compiling rustls v0.22.0-alpha.0 (/home/jbp/rustls/rustls)
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available for DefId(20:1808 ~ rustls[b796]::tls13::chacha20_poly1305_extract_keys)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/compiler/rustc_errors/src/lib.rs:1651:9
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::HandlerInner>::bug::<alloc::string::String>
   2: <rustc_errors::Handler>::bug::<alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_monomorphize::collector::should_codegen_locally
   8: rustc_monomorphize::collector::collect_miri
   9: rustc_monomorphize::collector::collect_miri
  10: rustc_monomorphize::collector::collect_miri
  11: rustc_monomorphize::collector::collect_miri
  12: rustc_monomorphize::collector::collect_items_rec
  13: rustc_data_structures::sync::par_for_each_in::<alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  14: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
  15: rustc_monomorphize::collector::collect_crate_mono_items
  16: rustc_monomorphize::partitioning::collect_and_partition_mono_items
  17: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  18: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  19: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  20: rustc_interface::passes::start_codegen
  21: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
  22: <rustc_interface::queries::Queries>::ongoing_codegen
  23: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
  24: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  25: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.71.1 (eb26296b5 2023-08-03) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -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 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `rustls` (example "bench")

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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