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

ICE: failed to resolve instance -Zprint-mono-items=eager #109297

Closed
matthiaskrgr opened this issue Mar 18, 2023 · 2 comments · Fixed by #109321
Closed

ICE: failed to resolve instance -Zprint-mono-items=eager #109297

matthiaskrgr opened this issue Mar 18, 2023 · 2 comments · Fixed by #109321
Assignees
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

@matthiaskrgr
Copy link
Member

Code

#![crate_type="lib"]
pub trait Visit {
    fn visit() {}
}

pub trait Array {
    type Element;
}

impl<'a> Visit for () where
    (): Array<Element=&'a ()>,
{}

impl Array for () {
    type Element = ();
}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (13afbdaa0 2023-03-17)
binary: rustc
commit-hash: 13afbdaa0655dda23d7129e59ac48f1ec88b2084
commit-date: 2023-03-17
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

rustc file.rs -Zprint-mono-items=eager

<output>
Backtrace

warning: function `visit` is never used
  --> ./icemaker/B478CCFAD84E06AE49B9831574596D9139EECE93258F58974F01E492096D8F59.rs:18:4
   |
18 | fn visit() {}
   |    ^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

error: internal compiler error: compiler/rustc_middle/src/ty/instance.rs:397:18: failed to resolve instance for <() as Visit>::visit

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7f661ee7d39a - std::backtrace_rs::backtrace::libunwind::trace::h84d2711f38e4d049
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f661ee7d39a - std::backtrace_rs::backtrace::trace_unsynchronized::h07f6ebc5344709db
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f661ee7d39a - std::sys_common::backtrace::_print_fmt::h05a29271ab24b307
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f661ee7d39a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2badcaa62266c6d2
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f661eee09be - core::fmt::write::h029bd029dcf67de1
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f661ee70225 - std::io::Write::write_fmt::h80e1934b9bd451b8
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/io/mod.rs:1684:15
   6:     0x7f661ee7d165 - std::sys_common::backtrace::_print::hd15e10f9274c89b0
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f661ee7d165 - std::sys_common::backtrace::print::h170965e4e66b5ee4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f661ee7fedf - std::panicking::default_hook::{{closure}}::h0164004bb09e0366
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:271:22
   9:     0x7f661ee7fc1b - std::panicking::default_hook::h5e2940911ec5582f
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:290:9
  10:     0x7f661dbf2415 - rustc_driver_impl[bad2ed848d64dbdc]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f661ee8071d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0f3cc38fa49d6ba4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:2002:9
  12:     0x7f661ee8071d - std::panicking::rust_panic_with_hook::h591d1df500c4db69
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:696:13
  13:     0x7f661e12aef1 - std[b4247acdb72724ff]::panicking::begin_panic::<rustc_errors[48bb1377a0478866]::ExplicitBug>::{closure#0}
  14:     0x7f661e128996 - std[b4247acdb72724ff]::sys_common::backtrace::__rust_end_short_backtrace::<std[b4247acdb72724ff]::panicking::begin_panic<rustc_errors[48bb1377a0478866]::ExplicitBug>::{closure#0}, !>
  15:     0x7f661e13ec96 - std[b4247acdb72724ff]::panicking::begin_panic::<rustc_errors[48bb1377a0478866]::ExplicitBug>
  16:     0x7f661e1a10d6 - std[b4247acdb72724ff]::panic::panic_any::<rustc_errors[48bb1377a0478866]::ExplicitBug>
  17:     0x7f661e19e896 - <rustc_errors[48bb1377a0478866]::HandlerInner>::bug::<&alloc[c5857ad37805d36e]::string::String>
  18:     0x7f661e19e560 - <rustc_errors[48bb1377a0478866]::Handler>::bug::<&alloc[c5857ad37805d36e]::string::String>
  19:     0x7f661e19684b - rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt::<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}
  20:     0x7f661e19529a - rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_opt::<rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f661e195266 - rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_context_opt::<rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_opt<rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f661e196796 - rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt::<rustc_span[4d522547309d7b79]::span_encoding::Span>
  23:     0x7f661c2874e3 - rustc_middle[eaf6378de1cdbfa8]::util::bug::bug_fmt
  24:     0x7f661d58d342 - <rustc_middle[eaf6378de1cdbfa8]::ty::instance::Instance>::expect_resolve
  25:     0x7f661d09dbb9 - rustc_monomorphize[589fc27a96a813aa]::collector::collect_roots
  26:     0x7f661d094f0e - <rustc_session[8656a7a78cf578e4]::session::Session>::time::<alloc[c5857ad37805d36e]::vec::Vec<rustc_middle[eaf6378de1cdbfa8]::mir::mono::MonoItem>, rustc_monomorphize[589fc27a96a813aa]::collector::collect_crate_mono_items::{closure#0}>
  27:     0x7f661d094cc1 - rustc_monomorphize[589fc27a96a813aa]::collector::collect_crate_mono_items
  28:     0x7f661d093120 - rustc_monomorphize[589fc27a96a813aa]::partitioning::collect_and_partition_mono_items
  29:     0x7f661cde98b2 - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::collect_and_partition_mono_items, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  30:     0x7f661cde956d - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::collect_and_partition_mono_items
  31:     0x7f661d3b3e17 - rustc_codegen_ssa[4bc24aeebcd9fcf0]::back::symbol_export::exported_symbols_provider_local
  32:     0x7f661d35449a - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::exported_symbols, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  33:     0x7f661d3540f1 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::exported_symbols
  34:     0x7f661ce7eb41 - <rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::EncodeContext>::encode_crate_root
  35:     0x7f661ce11c53 - rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::encode_metadata_impl
  36:     0x7f661ce072ac - rustc_data_structures[8426954b093953dd]::sync::join::<rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
  37:     0x7f661ce06fc1 - rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::encode_metadata
  38:     0x7f661ce0632a - rustc_metadata[e926187d3f7f9ccf]::fs::encode_and_write_metadata
  39:     0x7f661cdfdc9e - rustc_interface[dde792dfc5bb5edd]::passes::start_codegen
  40:     0x7f661cdfaa38 - <rustc_middle[eaf6378de1cdbfa8]::ty::context::GlobalCtxt>::enter::<<rustc_interface[dde792dfc5bb5edd]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<alloc[c5857ad37805d36e]::boxed::Box<dyn core[9847d4a2e8a02df2]::any::Any>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  41:     0x7f661cdf8f94 - <rustc_interface[dde792dfc5bb5edd]::queries::Queries>::ongoing_codegen
  42:     0x7f661cdf8561 - <rustc_interface[dde792dfc5bb5edd]::interface::Compiler>::enter::<rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}::{closure#2}, core[9847d4a2e8a02df2]::result::Result<core[9847d4a2e8a02df2]::option::Option<rustc_interface[dde792dfc5bb5edd]::queries::Linker>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  43:     0x7f661cdf6630 - rustc_span[4d522547309d7b79]::with_source_map::<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  44:     0x7f661cdf5bd9 - std[b4247acdb72724ff]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  45:     0x7f661d4e6afa - <<std[b4247acdb72724ff]::thread::Builder>::spawn_unchecked_<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#1} as core[9847d4a2e8a02df2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:     0x7f661ee8a5f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h51bca2043facf7d3
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  47:     0x7f661ee8a5f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h365da710d54db7ab
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  48:     0x7f661ee8a5f3 - std::sys::unix::thread::Thread::new::thread_start::hb322f3a535acf0fe
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
  49:     0x7f661a89ebb5 - <unknown>
  50:     0x7f661a920d90 - <unknown>
  51:                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.70.0-nightly (13afbdaa0 2023-03-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z print-mono-items=eager

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
error: aborting due to previous error; 1 warning emitted

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Mar 18, 2023
@Noratrieb Noratrieb added the requires-nightly This issue requires a nightly compiler in some way. label Mar 18, 2023
@matthiaskrgr

This comment was marked as outdated.

@matthiaskrgr
Copy link
Member Author

Regression in rust-lang-ci@8435d25

searched nightlies: from nightly-2022-12-02 to nightly-2023-03-18
regressed nightly: nightly-2022-12-13
searched commit range: bdb07a8...37d7de3
regressed commit: 2176e3a

bisected with cargo-bisect-rustc v0.6.5

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --script=/home/matthias/vcs/github/rust_bisect/script.sh --test-dir=/home/matthias/vcs/github/rust_bisect/foo

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