Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo test panics: no MIR available for DefId #96934

Closed
rMazeiks opened this issue May 11, 2022 · 1 comment · Fixed by #97096
Closed

cargo test panics: no MIR available for DefId #96934

rMazeiks opened this issue May 11, 2022 · 1 comment · Fixed by #97096
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@rMazeiks
Copy link

rMazeiks commented May 11, 2022

Edit: added reproducible example

Code

This is a minimal (i think) example of a crate that makes Cargo panic.

lib.rs:

mod inner {
    pub struct conflict;

    impl conflict {
        pub fn do_stuff(&self) {}
    }
}
mod conflict {}

pub use inner::*;

examples/example.rs

fn main() {
    dioxus::conflict.do_stuff();
}

Test or run the example to get the panic:

# cargo panics:
cargo test

# or
cargo run --example example

Meta

Reproduced on both stable and nightly. I'm on linux but CI tells me this also occurs on Windows and MacOS.

rustc --version --verbose:

rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: x86_64-unknown-linux-gnu
release: 1.60.0
LLVM version: 14.0.0

rustc 1.62.0-nightly (ecd44958e 2022-05-10)
binary: rustc
commit-hash: ecd44958e0a21110d09862ee080d95a4ca6c52f8
commit-date: 2022-05-10
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1

Error output

error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:993:9: no MIR available for DefId(20:7 ~ dioxus[5642]::inner::{impl#0}::do_stuff)
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/compiler/rustc_errors/src/lib.rs:1335:9
stack backtrace:
   0:     0x7f9fa9915e7d - std::backtrace_rs::backtrace::libunwind::trace::h85cc47332f2b05a9
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9fa9915e7d - std::backtrace_rs::backtrace::trace_unsynchronized::h822c2fc2b1a1a752
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9fa9915e7d - std::sys_common::backtrace::_print_fmt::h678c9b8abf6c5083
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f9fa9915e7d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2fb21895faf729c2
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f9fa9971afc - core::fmt::write::h6dc4a63f2d3360d8
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/core/src/fmt/mod.rs:1196:17
   5:     0x7f9fa9907561 - std::io::Write::write_fmt::h8fe2d520dd3fbf2e
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/io/mod.rs:1654:15
   6:     0x7f9fa9918b95 - std::sys_common::backtrace::_print::h6c3478d5fa62e7d8
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f9fa9918b95 - std::sys_common::backtrace::print::hd6d4473e0c0113a9
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f9fa9918b95 - std::panicking::default_hook::{{closure}}::h4dec78d051eecf7c
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/panicking.rs:295:22
   9:     0x7f9fa9918809 - std::panicking::default_hook::hc13b58dcc91e88ba
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/panicking.rs:314:9
  10:     0x7f9faa0dab21 - rustc_driver[d4386f1a79afc323]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f9fa9919366 - std::panicking::rust_panic_with_hook::h3dd403ae323eac6a
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/panicking.rs:702:17
  12:     0x7f9fab162781 - std[d9fedb1e1dbc9663]::panicking::begin_panic::<rustc_errors[b91ec0213766c8bc]::ExplicitBug>::{closure#0}
  13:     0x7f9fab15cc56 - std[d9fedb1e1dbc9663]::sys_common::backtrace::__rust_end_short_backtrace::<std[d9fedb1e1dbc9663]::panicking::begin_panic<rustc_errors[b91ec0213766c8bc]::ExplicitBug>::{closure#0}, !>
  14:     0x7f9fab0f3756 - std[d9fedb1e1dbc9663]::panicking::begin_panic::<rustc_errors[b91ec0213766c8bc]::ExplicitBug>
  15:     0x7f9fab1206f6 - std[d9fedb1e1dbc9663]::panic::panic_any::<rustc_errors[b91ec0213766c8bc]::ExplicitBug>
  16:     0x7f9fab115515 - <rustc_errors[b91ec0213766c8bc]::HandlerInner>::bug::<&alloc[4e51958440f9dea6]::string::String>
  17:     0x7f9fab115080 - <rustc_errors[b91ec0213766c8bc]::Handler>::bug::<&alloc[4e51958440f9dea6]::string::String>
  18:     0x7f9fab16b07d - rustc_middle[7208bd69784e7596]::ty::context::tls::with_opt::<rustc_middle[7208bd69784e7596]::util::bug::opt_span_bug_fmt<rustc_span[5ada1bf86533b524]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7f9fab16b3f6 - rustc_middle[7208bd69784e7596]::util::bug::opt_span_bug_fmt::<rustc_span[5ada1bf86533b524]::span_encoding::Span>
  20:     0x7f9fab16b373 - rustc_middle[7208bd69784e7596]::util::bug::bug_fmt
  21:     0x7f9fab4a1880 - rustc_monomorphize[666faa1c7ca59088]::collector::collect_neighbours
  22:     0x7f9fab4992c2 - rustc_monomorphize[666faa1c7ca59088]::collector::collect_items_rec
  23:     0x7f9fac2e304b - <rustc_session[93b3d23ec172418c]::session::Session>::time::<(), rustc_monomorphize[666faa1c7ca59088]::collector::collect_crate_mono_items::{closure#1}>
  24:     0x7f9fac2d7fcb - rustc_monomorphize[666faa1c7ca59088]::collector::collect_crate_mono_items
  25:     0x7f9fac2dec76 - rustc_monomorphize[666faa1c7ca59088]::partitioning::collect_and_partition_mono_items
  26:     0x7f9faa9c0a48 - <rustc_middle[7208bd69784e7596]::dep_graph::dep_node::DepKind as rustc_query_system[d391a3ff2bd3fbc4]::dep_graph::DepKind>::with_deps::<<rustc_query_system[d391a3ff2bd3fbc4]::dep_graph::graph::DepGraph<rustc_middle[7208bd69784e7596]::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_middle[7208bd69784e7596]::ty::context::TyCtxt, (), (&std[d9fedb1e1dbc9663]::collections::hash::set::HashSet<rustc_span[5ada1bf86533b524]::def_id::DefId, core[9ba3ef39911e8828]::hash::BuildHasherDefault<rustc_hash[6e272a3b223b8a2c]::FxHasher>>, &[rustc_middle[7208bd69784e7596]::mir::mono::CodegenUnit])>::{closure#0}, (&std[d9fedb1e1dbc9663]::collections::hash::set::HashSet<rustc_span[5ada1bf86533b524]::def_id::DefId, core[9ba3ef39911e8828]::hash::BuildHasherDefault<rustc_hash[6e272a3b223b8a2c]::FxHasher>>, &[rustc_middle[7208bd69784e7596]::mir::mono::CodegenUnit])>
  27:     0x7f9faaa37ae1 - <rustc_query_system[d391a3ff2bd3fbc4]::dep_graph::graph::DepGraph<rustc_middle[7208bd69784e7596]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[7208bd69784e7596]::ty::context::TyCtxt, (), (&std[d9fedb1e1dbc9663]::collections::hash::set::HashSet<rustc_span[5ada1bf86533b524]::def_id::DefId, core[9ba3ef39911e8828]::hash::BuildHasherDefault<rustc_hash[6e272a3b223b8a2c]::FxHasher>>, &[rustc_middle[7208bd69784e7596]::mir::mono::CodegenUnit])>
  28:     0x7f9fac6da85c - rustc_query_system[d391a3ff2bd3fbc4]::query::plumbing::try_execute_query::<rustc_query_impl[d4cc4f0a253379a9]::plumbing::QueryCtxt, rustc_query_system[d391a3ff2bd3fbc4]::query::caches::DefaultCache<(), (&std[d9fedb1e1dbc9663]::collections::hash::set::HashSet<rustc_span[5ada1bf86533b524]::def_id::DefId, core[9ba3ef39911e8828]::hash::BuildHasherDefault<rustc_hash[6e272a3b223b8a2c]::FxHasher>>, &[rustc_middle[7208bd69784e7596]::mir::mono::CodegenUnit])>>
  29:     0x7f9fac70fc00 - rustc_query_system[d391a3ff2bd3fbc4]::query::plumbing::get_query::<rustc_query_impl[d4cc4f0a253379a9]::queries::collect_and_partition_mono_items, rustc_query_impl[d4cc4f0a253379a9]::plumbing::QueryCtxt>
  30:     0x7f9fac65b7d2 - <rustc_query_impl[d4cc4f0a253379a9]::Queries as rustc_middle[7208bd69784e7596]::ty::query::QueryEngine>::collect_and_partition_mono_items
  31:     0x7f9fac1c4b84 - rustc_codegen_ssa[afbe1fd0376e08de]::base::codegen_crate::<rustc_codegen_llvm[53437695cdd61ca1]::LlvmCodegenBackend>
  32:     0x7f9fac1b1043 - <rustc_codegen_llvm[53437695cdd61ca1]::LlvmCodegenBackend as rustc_codegen_ssa[afbe1fd0376e08de]::traits::backend::CodegenBackend>::codegen_crate
  33:     0x7f9fac1787d7 - <rustc_session[93b3d23ec172418c]::session::Session>::time::<alloc[4e51958440f9dea6]::boxed::Box<dyn core[9ba3ef39911e8828]::any::Any>, rustc_interface[50aa842067ddf2a9]::passes::start_codegen::{closure#0}>
  34:     0x7f9fac175b2c - <rustc_interface[50aa842067ddf2a9]::passes::QueryContext>::enter::<<rustc_interface[50aa842067ddf2a9]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[9ba3ef39911e8828]::result::Result<alloc[4e51958440f9dea6]::boxed::Box<dyn core[9ba3ef39911e8828]::any::Any>, rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>
  35:     0x7f9fac19ab2f - <rustc_interface[50aa842067ddf2a9]::queries::Queries>::ongoing_codegen
  36:     0x7f9fac142beb - <rustc_interface[50aa842067ddf2a9]::interface::Compiler>::enter::<rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}::{closure#2}, core[9ba3ef39911e8828]::result::Result<core[9ba3ef39911e8828]::option::Option<rustc_interface[50aa842067ddf2a9]::queries::Linker>, rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>
  37:     0x7f9fac16af4f - rustc_span[5ada1bf86533b524]::with_source_map::<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_interface[50aa842067ddf2a9]::interface::create_compiler_and_run<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>::{closure#1}>
  38:     0x7f9fac143824 - rustc_interface[50aa842067ddf2a9]::interface::create_compiler_and_run::<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>
  39:     0x7f9fac1410d2 - <scoped_tls[48edcdfa9356486f]::ScopedKey<rustc_span[5ada1bf86533b524]::SessionGlobals>>::set::<rustc_interface[50aa842067ddf2a9]::interface::run_compiler<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>
  40:     0x7f9fac1581ef - std[d9fedb1e1dbc9663]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[50aa842067ddf2a9]::util::run_in_thread_pool_with_globals<rustc_interface[50aa842067ddf2a9]::interface::run_compiler<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>
  41:     0x7f9fac158329 - <<std[d9fedb1e1dbc9663]::thread::Builder>::spawn_unchecked_<rustc_interface[50aa842067ddf2a9]::util::run_in_thread_pool_with_globals<rustc_interface[50aa842067ddf2a9]::interface::run_compiler<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>::{closure#1} as core[9ba3ef39911e8828]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f9fa9923273 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8e61158325523155
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/alloc/src/boxed.rs:1872:9
  43:     0x7f9fa9923273 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha439966d612c01d5
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/alloc/src/boxed.rs:1872:9
  44:     0x7f9fa9923273 - std::sys::unix::thread::Thread::new::thread_start::hf215f8619fb489d4
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys/unix/thread.rs:108:17
  45:     0x7f9fa9841609 - start_thread
                               at /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
  46:     0x7f9fa975a163 - clone
  47:                0x0 - <unknown>

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.62.0-nightly (ecd44958e 2022-05-10) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

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 `dioxus`
warning: build failed, waiting for other jobs to finish...
warning: `dioxus` (lib test) generated 2 warnings (2 duplicates)

@rMazeiks rMazeiks added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 11, 2022
@JohnTitor JohnTitor added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label May 11, 2022
@rMazeiks
Copy link
Author

rMazeiks commented May 11, 2022

I managed to make a small reproducible example!

I've now added it above.

rMazeiks added a commit to rMazeiks/dioxus that referenced this issue May 11, 2022
…me name

Not sure if this was supposed to be allowed, but it was causing rust-lang/rust#96934
@tmiasko tmiasko removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label May 11, 2022
@tmiasko tmiasko self-assigned this May 16, 2022
@bors bors closed this as completed in f597846 May 18, 2022
@tmiasko tmiasko removed their assignment May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants