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 in collect_and_partition_mono_items #57430

Closed
vorner opened this issue Jan 7, 2019 · 3 comments
Closed

ICE in collect_and_partition_mono_items #57430

vorner opened this issue Jan 7, 2019 · 3 comments
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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

@vorner
Copy link
Contributor

vorner commented Jan 7, 2019

I don't really know where to start minimizing this thing. The code is a nasty beast and not everything in the repository compiles right now (I'm currently struggling with HRTBs in there and such). Anyway:

  • Clone the https://github.com/vorner/spirit repository
  • Check out the commit 0ce253e4ec35a8accaf4924f17180cd0a9696e78
  • Run cargo +nightly-2019-01-07 run --package spirit-reqwest --example make_request
  • The following ICE falls out:
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:747: Cannot create local mono-item for DefId(21/0:300 ~ config[6427]::file[0]::{{impl}}[0]::from_str[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:590:9
stack backtrace:
   0:     0x7fd0230b01a3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h1492ea7cec121a33
                               at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1:     0x7fd0230a8808 - std::sys_common::backtrace::_print::h28383da39102314d
                               at src/libstd/sys_common/backtrace.rs:70
   2:     0x7fd0230ac332 - std::panicking::default_hook::{{closure}}::h6958e24be6a075eb
                               at src/libstd/sys_common/backtrace.rs:58
                               at src/libstd/panicking.rs:200
   3:     0x7fd0230ac0a4 - std::panicking::default_hook::h453a171789f64b19
                               at src/libstd/panicking.rs:215
   4:     0x7fd01f3114ff - rustc::util::common::panic_hook::hef4cee339a2b4fc5
   5:     0x7fd0230acb19 - std::panicking::rust_panic_with_hook::hdef6b4d70bac6cdb
                               at src/libstd/panicking.rs:482
   6:     0x7fd01e17f4cc - std::panicking::begin_panic::hff504b5ae3f2aed9
   7:     0x7fd01e19e38e - rustc_errors::Handler::bug::ha00d071a7722ac53
   8:     0x7fd01f17e5de - rustc::util::bug::opt_span_bug_fmt::{{closure}}::hfd250b1fd98637e5
   9:     0x7fd01f17d9c9 - rustc::ty::context::tls::with_opt::{{closure}}::h3796fb43b823cc58
  10:     0x7fd01f17d8e4 - rustc::ty::context::tls::with_context_opt::h07df1bd288f39a1a
  11:     0x7fd01f17d976 - rustc::ty::context::tls::with_opt::h4dd2a44bcfb8fb2b
  12:     0x7fd01f17e4e4 - rustc::util::bug::opt_span_bug_fmt::hcb3688100a278b16
  13:     0x7fd01f17e456 - rustc::util::bug::bug_fmt::h62900f94ae194a93
  14:     0x7fd01ff28386 - rustc_mir::monomorphize::collector::should_monomorphize_locally::hb4972c21879246cd
  15:     0x7fd01ff27ff4 - rustc_mir::monomorphize::collector::visit_instance_use::he2b609b042c96762
  16:     0x7fd01ff27a78 - <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator_kind::h95660bab391f4e89
  17:     0x7fd01ff24be6 - rustc_mir::monomorphize::collector::collect_items_rec::h67da2bf4b1a5e7c4
  18:     0x7fd01ff2587f - rustc_mir::monomorphize::collector::collect_items_rec::h67da2bf4b1a5e7c4
  19:     0x7fd01ff2587f - rustc_mir::monomorphize::collector::collect_items_rec::h67da2bf4b1a5e7c4
  20:     0x7fd01ff2587f - rustc_mir::monomorphize::collector::collect_items_rec::h67da2bf4b1a5e7c4
  21:     0x7fd01ff2587f - rustc_mir::monomorphize::collector::collect_items_rec::h67da2bf4b1a5e7c4
  22:     0x7fd01ff2587f - rustc_mir::monomorphize::collector::collect_items_rec::h67da2bf4b1a5e7c4
  23:     0x7fd01ff2587f - rustc_mir::monomorphize::collector::collect_items_rec::h67da2bf4b1a5e7c4
  24:     0x7fd01ff2587f - rustc_mir::monomorphize::collector::collect_items_rec::h67da2bf4b1a5e7c4
  25:     0x7fd01ff9f3ad - rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}::h2af1c87112323a03
  26:     0x7fd01ff4c286 - rustc::util::common::time::h286b1dad20da2123
  27:     0x7fd01ff23e0d - rustc_mir::monomorphize::collector::collect_crate_mono_items::h4e9b3a8e4f502e53
  28:     0x7fd01ff4c3da - rustc::util::common::time::h3aed30c09566a540
  29:     0x7fd01fcbb9e3 - rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items::h67f94873bae784e8
  30:     0x7fd0193e61b6 - rustc::ty::query::__query_compute::collect_and_partition_mono_items::h9f82d9bdf2152918
  31:     0x7fd0193e6598 - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::collect_and_partition_mono_items<'tcx>>::compute::hfe18cd95125d7663
  32:     0x7fd01946b18e - rustc::dep_graph::graph::DepGraph::with_task_impl::h4e09c0812e8abf24
  33:     0x7fd0193f2f38 - <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start::hf6ee6068f239879a
  34:     0x7fd01943cf15 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job::h4d71449d6af3571d
  35:     0x7fd01943358b - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with::hec8615cd2811433c
  36:     0x7fd0193d247d - rustc_codegen_ssa::base::codegen_crate::hf7f8c50778209cf8
  37:     0x7fd01934f3f0 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate::hcba196557f52fae6
  38:     0x7fd023437bd0 - rustc_driver::driver::phase_4_codegen::hade065a8cf6f26a2
  39:     0x7fd0234651d0 - rustc_driver::driver::compile_input::{{closure}}::hdd7466c093d6d3e7
  40:     0x7fd02346312c - <std::thread::local::LocalKey<T>>::with::he31a810ca003f552
  41:     0x7fd023403e0a - rustc::ty::context::TyCtxt::create_and_enter::h3a3af1489d7c446f
  42:     0x7fd02342d4b6 - rustc_driver::driver::compile_input::h20eaf82f3f6aeec8
  43:     0x7fd0233ad799 - rustc_driver::run_compiler_with_pool::hbe3be3b5f19e38c8
  44:     0x7fd0233b8af5 - <scoped_tls::ScopedKey<T>>::set::h4aeac58e4b7eb0a1
  45:     0x7fd0233ac60a - rustc_driver::run_compiler::hde99c109f350f677
  46:     0x7fd0233b8caa - <scoped_tls::ScopedKey<T>>::set::hf1be8bd8767bcc8f
  47:     0x7fd0233ea2a2 - syntax::with_globals::h2a92913243b46dbe
  48:     0x7fd0230bddc9 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:92
  49:     0x7fd023494c40 - <F as alloc::boxed::FnBox<A>>::call_box::h4c895f5df8f64c8f
  50:     0x7fd0230bcbbd - std::sys::unix::thread::Thread::new::thread_start::h967e067038c0ee09
                               at /rustc/b92552d5578e4544006da0dd5e793a19c2149321/src/liballoc/boxed.rs:744
                               at src/libstd/sys_common/thread.rs:14
                               at src/libstd/sys/unix/thread.rs:81
  51:     0x7fd022fc03c2 - <unknown>
                               at /usr/src/debug/sys-libs/glibc-2.28-r4/glibc-2.28/nptl/pthread_create.c:486
  52:     0x7fd022ed42de - clone
                               at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  53:                0x0 - <unknown>
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error


note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.33.0-nightly (b92552d55 2019-01-06) running on x86_64-unknown-linux-gnu

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

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `spirit-reqwest`.

To learn more, run the command again with --verbose.

It runs fine with rustc 1.33.0-nightly (9eac38634 2018-12-31), but fails with:

$ rustc +nightly-2019-01-07 --version --verbose
rustc 1.33.0-nightly (b92552d55 2019-01-06)
binary: rustc
commit-hash: b92552d5578e4544006da0dd5e793a19c2149321
commit-date: 2019-01-06
host: x86_64-unknown-linux-gnu
release: 1.33.0-nightly
LLVM version: 8.0
@estebank estebank added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 8, 2019
@vorner
Copy link
Contributor Author

vorner commented Jan 8, 2019

This seems to have disappeared on the newest nightly (it now compiles fine and runs). So let's close this and thanks :-) (if anyone has an idea what happened here, where it got fixed or has a shorter example that can be put into a test, that would still be nice)

@vorner vorner closed this as completed Jan 8, 2019
@jonhoo
Copy link
Contributor

jonhoo commented Mar 6, 2020

This ICE is back on rustc 1.43.0-nightly (96bb8b31c 2020-03-05) it seems.

Clone this commit of noria and run

$ cargo b -p noria-server

(it takes a while)

You'll then end up with:

error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:745: cannot create local mono-item for DefId(27:436 ~ noria[a50e]::view[0]::results[0]::{{impl}}[0]::new[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:875:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1053
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /rustc/96bb8b31c81dc2394317f2f083c3acf8087efea1/src/liballoc/boxed.rs:1031
  12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /rustc/96bb8b31c81dc2394317f2f083c3acf8087efea1/src/libproc_macro/bridge/client.rs:305
  13: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  14: std::panicking::begin_panic
  15: rustc_errors::HandlerInner::bug
  16: rustc_errors::Handler::bug
  17: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  18: rustc::ty::context::tls::with_opt::{{closure}}
  19: rustc::ty::context::tls::with_opt
  20: rustc::util::bug::opt_span_bug_fmt
  21: rustc::util::bug::bug_fmt
  22: rustc_mir::monomorphize::collector::should_monomorphize_locally
  23: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc::mir::visit::Visitor>::visit_terminator_kind
  24: rustc_mir::monomorphize::collector::collect_items_rec
  25: rustc_mir::monomorphize::collector::collect_items_rec
  26: rustc_mir::monomorphize::collector::collect_items_rec
  27: rustc_mir::monomorphize::collector::collect_items_rec
  28: rustc_mir::monomorphize::collector::collect_items_rec
  29: rustc_mir::monomorphize::collector::collect_items_rec
  30: rustc_mir::monomorphize::collector::collect_items_rec
  31: rustc_mir::monomorphize::collector::collect_items_rec
  32: rustc_mir::monomorphize::collector::collect_items_rec
  33: rustc_mir::monomorphize::collector::collect_items_rec
  34: rustc_mir::monomorphize::collector::collect_items_rec
  35: rustc_mir::monomorphize::collector::collect_items_rec
  36: rustc_mir::monomorphize::collector::collect_items_rec
  37: rustc_mir::monomorphize::collector::collect_items_rec
  38: rustc_mir::monomorphize::collector::collect_items_rec
  39: rustc_mir::monomorphize::collector::collect_items_rec
  40: rustc_mir::monomorphize::collector::collect_items_rec
  41: rustc_mir::monomorphize::collector::collect_items_rec
  42: rustc_mir::monomorphize::collector::collect_items_rec
  43: rustc_mir::monomorphize::collector::collect_items_rec
  44: rustc_mir::monomorphize::collector::collect_items_rec
  45: rustc_mir::monomorphize::collector::collect_items_rec
  46: rustc_mir::monomorphize::collector::collect_items_rec
  47: rustc_mir::monomorphize::collector::collect_items_rec
  48: rustc_mir::monomorphize::collector::collect_items_rec
  49: rustc_mir::monomorphize::collector::collect_items_rec
  50: rustc_mir::monomorphize::collector::collect_items_rec
  51: rustc_mir::monomorphize::collector::collect_items_rec
  52: rustc_session::utils::<impl rustc_session::session::Session>::time
  53: rustc_mir::monomorphize::collector::collect_crate_mono_items
  54: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  55: rustc::ty::query::__query_compute::collect_and_partition_mono_items
  56: rustc::dep_graph::graph::DepGraph::with_task_impl
  57: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  58: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
  59: rustc::ty::query::__query_compute::exported_symbols
  60: rustc::dep_graph::graph::DepGraph::with_task_impl
  61: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  62: rustc_metadata::rmeta::encoder::EncodeContext::encode_crate_root
  63: rustc::dep_graph::graph::DepGraph::with_ignore
  64: rustc_metadata::rmeta::encoder::encode_metadata
  65: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata
  66: rustc::ty::context::TyCtxt::encode_metadata
  67: rustc_interface::passes::start_codegen
  68: rustc::ty::context::tls::enter_global
  69: rustc_interface::queries::Queries::ongoing_codegen
  70: rustc_interface::interface::run_compiler_in_existing_thread_pool
  71: rustc_ast::attr::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (96bb8b31c 2020-03-05) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental -C target-cpu=native --crate-type lib

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] exported_symbols
end of query stack
error: aborting due to previous error

error: could not compile `noria-server`.

@jonhoo
Copy link
Contributor

jonhoo commented Mar 6, 2020

Minified in #69785.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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

No branches or pull requests

3 participants