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: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available #111320

Closed
Tracked by #393
y21 opened this issue May 7, 2023 · 6 comments · Fixed by #111371
Closed
Tracked by #393

ICE: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available #111320

y21 opened this issue May 7, 2023 · 6 comments · Fixed by #111371
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@y21
Copy link
Member

y21 commented May 7, 2023

Code

Haven't been able to minimize it yet, but it can be reproduced by creating a new cargo project, adding matrix-sdk = "0.6.2" to the dependencies and compiling it with nightly rustc 2023-05-06

Edit: Minimized test case: #111320 (comment)

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (a77c55248 2023-05-06)
binary: rustc
commit-hash: a77c552485a19245a266bc03c450676c666b605f
commit-date: 2023-05-06
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available for DefId(88:2950 ~ matrix_sdk_crypto[84c8]::types::{impl#12}::algorithm)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/a77c552485a19245a266bc03c450676c666b605f/compiler/rustc_errors/src/lib.rs:1650:9
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.0-nightly (a77c55248 2023-05-06) running on x86_64-unknown-linux-gnu

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

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
#1 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available for DefId(88:2952 ~ matrix_sdk_crypto[84c8]::types::{impl#13}::algorithm)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/a77c552485a19245a266bc03c450676c666b605f/compiler/rustc_errors/src/lib.rs:1650:9

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.0-nightly (a77c55248 2023-05-06) running on x86_64-unknown-linux-gnu

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

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
#1 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/a77c552485a19245a266bc03c450676c666b605f/compiler/rustc_errors/src/lib.rs:1650:9

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.0-nightly (a77c55248 2023-05-06) running on x86_64-unknown-linux-gnu

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

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
#1 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
error: could not compile `matrix-sdk-sled` (lib)
Backtrace

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::collect_neighbours
   8: rustc_monomorphize::collector::collect_items_rec
   9: rustc_monomorphize::collector::collect_items_rec
  10: rustc_monomorphize::collector::collect_items_rec
  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::collector::collect_items_rec
  22: rustc_monomorphize::collector::collect_items_rec
  23: rustc_monomorphize::collector::collect_items_rec
  24: rustc_monomorphize::collector::collect_items_rec
  25: rustc_monomorphize::collector::collect_items_rec
  26: rustc_monomorphize::collector::collect_items_rec
  27: rustc_monomorphize::collector::collect_items_rec
  28: rustc_monomorphize::collector::collect_items_rec
  29: rustc_monomorphize::collector::collect_items_rec
  30: rustc_monomorphize::collector::collect_items_rec
  31: rustc_monomorphize::collector::collect_items_rec
  32: rustc_monomorphize::collector::collect_items_rec
  33: rustc_monomorphize::collector::collect_items_rec
  34: rustc_monomorphize::collector::collect_items_rec
  35: rustc_monomorphize::collector::collect_items_rec
  36: rustc_monomorphize::collector::collect_items_rec
  37: rustc_monomorphize::collector::collect_items_rec
  38: rustc_monomorphize::collector::collect_items_rec
  39: rustc_monomorphize::collector::collect_items_rec
  40: rustc_monomorphize::collector::collect_items_rec
  41: rustc_monomorphize::collector::collect_items_rec
  42: rustc_monomorphize::collector::collect_items_rec
  43: rustc_monomorphize::collector::collect_items_rec
  44: rustc_monomorphize::collector::collect_items_rec
  45: rustc_monomorphize::collector::collect_items_rec
  46: rustc_monomorphize::collector::collect_items_rec
  47: rustc_monomorphize::collector::collect_items_rec
  48: rustc_monomorphize::collector::collect_items_rec
  49: rustc_monomorphize::collector::collect_items_rec
  50: rustc_monomorphize::collector::collect_items_rec
  51: rustc_monomorphize::collector::collect_items_rec
  52: rustc_monomorphize::collector::collect_items_rec
  53: rustc_monomorphize::collector::collect_items_rec
  54: rustc_monomorphize::collector::collect_items_rec
  55: rustc_monomorphize::collector::collect_items_rec
  56: rustc_monomorphize::collector::collect_items_rec
  57: rustc_monomorphize::collector::collect_items_rec
  58: rustc_monomorphize::collector::collect_items_rec
  59: rustc_monomorphize::collector::collect_items_rec
  60: rustc_monomorphize::collector::collect_items_rec
  61: rustc_monomorphize::collector::collect_items_rec
  62: rustc_monomorphize::collector::collect_items_rec
  63: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
  64: rustc_monomorphize::collector::collect_crate_mono_items
  65: rustc_monomorphize::partitioning::collect_and_partition_mono_items
  66: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::collect_and_partition_mono_items, rustc_query_impl::plumbing::QueryCtxt>
  67: rustc_query_impl::get_query::collect_and_partition_mono_items
  68: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
  69: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::exported_symbols, rustc_query_impl::plumbing::QueryCtxt>
  70: rustc_query_impl::get_query::exported_symbols
  71: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
  72: rustc_metadata::rmeta::encoder::encode_metadata_impl
  73: rustc_metadata::rmeta::encoder::encode_metadata
  74: rustc_metadata::fs::encode_and_write_metadata
  75: rustc_interface::passes::start_codegen
  76: <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>>
  77: <rustc_interface::queries::Queries>::ongoing_codegen
  78: <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>>
  79: 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}>

@y21 y21 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 7, 2023
@lukas-code
Copy link
Member

searched nightlies: from nightly-2023-05-05 to nightly-2023-05-07
regressed nightly: nightly-2023-05-07
searched commit range: f9a6b71...a77c552
regressed commit: 31a4f2d

bisected with cargo-bisect-rustc v0.6.6

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

cargo bisect-rustc --regress=ice -- build 

cc #110907 @Bryanskiy @petrochenkov

@lukas-code
Copy link
Member

lukas-code commented May 7, 2023

reduced:

// crate a
trait PrivTrait {
    fn priv_fn(&self);
}

pub struct ImplPrivTrait;

impl PrivTrait for ImplPrivTrait {
    fn priv_fn(&self) {}
}

pub struct Wrapper<T>(T);

pub trait PubTrait {
    fn pub_fn(&self);
}

impl<T: PrivTrait> PubTrait for Wrapper<T> {
    fn pub_fn(&self) {
        self.0.priv_fn()
    }
}
// crate b
use a::{Wrapper, ImplPrivTrait, PubTrait};

pub fn foo(x: Wrapper<ImplPrivTrait>) {
    x.pub_fn();
}

run cargo build

@Jules-Bertholet
Copy link
Contributor

@rustbot label regression-from-stable-to-nightly

@rustbot rustbot added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 8, 2023
@y21 y21 changed the title matrix-sdk crate ICEs: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available ICE: compiler/rustc_monomorphize/src/collector.rs:1038:9: no MIR available May 8, 2023
jplatte added a commit to matrix-org/matrix-rust-sdk that referenced this issue May 8, 2023
@Noratrieb Noratrieb pinned this issue May 8, 2023
@genusistimelord
Copy link

yeah having issues with nightly and wgpu as will with this exact error. I wonder what changes caused this issue.

@lukas-code
Copy link
Member

@genusistimelord This is caused by #110907, which is getting reverted in #111371. So if all goes well (and the github outage gets resolved soon) this should be fixed in tomorrow's nightly.

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-critical

@rustbot rustbot added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 10, 2023
@compiler-errors compiler-errors unpinned this issue May 15, 2023
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) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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.

6 participants