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

thread 'rustc' panicked at 'called Option::unwrap() on a None value #90594

Closed
ahl opened this issue Nov 4, 2021 · 14 comments
Closed

thread 'rustc' panicked at 'called Option::unwrap() on a None value #90594

ahl opened this issue Nov 4, 2021 · 14 comments
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ahl
Copy link
Contributor

ahl commented Nov 4, 2021

Code

With apologies: I don't have a minimal example, and the repo in which I saw this is not yet open.

Meta

rustc --version --verbose:

rustc 1.58.0-nightly (efd048394 2021-10-20)
binary: rustc
commit-hash: efd0483949496b067cd5f7569d1b28cd3d5d3c72
commit-date: 2021-10-20
host: x86_64-apple-darwin
release: 1.58.0-nightly
LLVM version: 13.0.0

Error output

WARN rustc_metadata::locator no metadata found: failed to mmap rmeta metadata: '/Users/ahl/src/omicron/target/debug/deps/libapi_identity-2688e0341215579a.rmeta'
WARN rustc_metadata::locator no metadata found: failed to mmap rmeta metadata: '/Users/ahl/src/omicron/target/debug/deps/libapi_identity-c2808c02b8973adb.rmeta'
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:18:85
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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.58.0-nightly (efd048394 2021-10-20) running on x86_64-apple-darwin

note: compiler flags: -C panic=abort -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `for<'c> fn(steno::saga_exec::ActionContext<sagas::SagaInstanceCreate>) -> impl core::future::future::Future {sagas::sic_instance_ensure}: steno::saga_action_func::ActionFn<'c, sagas::SagaInstanceCreate>`
#1 [codegen_fulfill_obligation] checking if `core::ops::unsize::CoerceUnsized` fulfills its obligations
end of query stack
Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:18:85
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_session::cstore::CrateStore for rustc_metadata::creader::CStore>::def_path_hash_to_def_id
   4: rustc_middle::ty::context::TyCtxt::def_path_hash_to_def_id
   5: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id
   6: rustc_query_impl::query_callbacks::type_of::force_from_dep_node
   7: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepContext for rustc_middle::ty::context::TyCtxt>::try_force_from_dep_node
   8: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   9: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
  10: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
  11: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
  12: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_green
  14: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory
  15: rustc_query_system::query::plumbing::try_execute_query
  16: rustc_query_system::query::plumbing::get_query
  17: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::evaluate_obligation
  18: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  19: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  20: rustc_trait_selection::traits::fulfill::FulfillProcessor::process_trait_obligation
  21: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
  22: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
  23: rustc_trait_selection::traits::fulfill::FulfillmentContext::select
  24: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  25: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_all_or_error
  26: rustc_trait_selection::traits::codegen::drain_fulfillment_cx_or_panic
  27: rustc_infer::infer::InferCtxtBuilder::enter
  28: rustc_trait_selection::traits::codegen::codegen_fulfill_obligation
  29: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  30: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  31: rustc_data_structures::stack::ensure_sufficient_stack
  32: rustc_query_system::query::plumbing::try_execute_query
  33: rustc_query_system::query::plumbing::get_query
  34: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::codegen_fulfill_obligation
  35: rustc_monomorphize::custom_coerce_unsize_info
  36: <rustc_monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_rvalue
  37: rustc_monomorphize::collector::collect_neighbours
  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_monomorphize::collector::collect_items_rec
  64: rustc_session::utils::<impl rustc_session::session::Session>::time
  65: rustc_monomorphize::collector::collect_crate_mono_items
  66: rustc_monomorphize::partitioning::collect_and_partition_mono_items
  67: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  68: rustc_data_structures::stack::ensure_sufficient_stack
  69: rustc_query_system::query::plumbing::try_execute_query
  70: rustc_query_system::query::plumbing::force_query
  71: rustc_query_impl::query_callbacks::collect_and_partition_mono_items::force_from_dep_node
  72: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepContext for rustc_middle::ty::context::TyCtxt>::try_force_from_dep_node
  73: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
  74: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_green
  75: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory
  76: rustc_data_structures::stack::ensure_sufficient_stack
  77: rustc_query_system::query::plumbing::try_execute_query
  78: rustc_query_system::query::plumbing::get_query
  79: rustc_metadata::rmeta::encoder::EncodeContext::encode_crate_root
  80: rustc_metadata::rmeta::encoder::encode_metadata_impl
  81: rustc_data_structures::sync::join
  82: rustc_metadata::rmeta::encoder::encode_metadata
  83: rustc_interface::queries::Queries::ongoing_codegen
  84: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  85: rustc_span::with_source_map
  86: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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.58.0-nightly (efd048394 2021-10-20) running on x86_64-apple-darwin

note: compiler flags: -C panic=abort -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `for<'c> fn(steno::saga_exec::ActionContext<sagas::SagaInstanceCreate>) -> impl core::future::future::Future {sagas::sic_instance_ensure}: steno::saga_action_func::ActionFn<'c, sagas::SagaInstanceCreate>`
#1 [codegen_fulfill_obligation] checking if `core::ops::unsize::CoerceUnsized` fulfills its obligations
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
#3 [exported_symbols] exported_symbols
end of query stack

@ahl ahl 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 Nov 4, 2021
@JohnTitor JohnTitor added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Nov 16, 2021
@loriopatrick
Copy link

Had the same issue, running cargo clean && cargo build --all resolve it.

@MartinKavik
Copy link

Also had the same issue, resolved by downgrading to Rust 1.56.1 and reinstalling 1.57.0. I've only changed some parts of an Actix app - nothing special, no dependency or configuration changes. Kubuntu 21.04.

@HindrikStegenga
Copy link

HindrikStegenga commented Dec 8, 2021

Ran into this issue as well after refactoring/moving files around. The solution provided by @loriopatrick fixed the issue.
(1.57.0 stable, macOS 12.0.1)

@TwoClocks
Copy link

I just ran into this on stable

rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0

It was reproducible until a copied the repro to start a minimal example. I could not reproduce in a clean env.

Deleting ./target fixed it in the original repro, so now I can't reproduce at all. I made zero code chnages.

My backtrace is slightly different

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:18:85
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:100:14
   2: core::panicking::panic
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:50:5
   3: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_session::cstore::CrateStore for rustc_metadata::creader::CStore>::def_path_hash_to_def_id
   4: <rustc_query_impl::on_disk_cache::OnDiskCache as rustc_middle::ty::context::OnDiskCache>::def_path_hash_to_def_id
   5: rustc_middle::dep_graph::dep_node::<impl rustc_query_system::dep_graph::dep_node::DepNodeParams<rustc_middle::ty::context::TyCtxt> for rustc_span::def_id::DefId>::recover
   6: rustc_query_system::query::plumbing::force_query
   7: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   8: rustc_query_system::query::plumbing::ensure_must_run
   9: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_liveness
  10: rustc_middle::hir::map::Map::for_each_module
  11: rustc_session::utils::<impl rustc_session::session::Session>::time
  12: rustc_interface::passes::analysis
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  14: rustc_data_structures::stack::ensure_sufficient_stack
  15: rustc_query_system::query::plumbing::try_execute_query
  16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  17: rustc_interface::passes::QueryContext::enter
  18: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  19: rustc_span::with_source_map
  20: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@codeflo
Copy link

codeflo commented Dec 13, 2021

I also hit this exact error message after moving files around, and I can confirm that it goes away after a cargo clean. (Unfortunately, I don't think I would have tried that if I hadn't found this GitHub issue.)

rustc 1.59.0-nightly (efec54529 2021-12-04)
binary: rustc
commit-hash: efec545293b9263be9edfb283a7aa66350b3acbf
commit-date: 2021-12-04
host: x86_64-pc-windows-msvc
release: 1.59.0-nightly
LLVM version: 13.0.0

@modulok
Copy link

modulok commented Dec 14, 2021

I just encountered this on FreeBSD 13.0-RELEASE. Unfortunately it vanishes when I copy the repo and re-build. Here's a vebose backtrace, for what it's worth:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:18:85
stack backtrace:
   0:        0x809d0a75c - std::backtrace_rs::backtrace::libunwind::trace::hbe714726001e366a
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:        0x809d0a75c - std::backtrace_rs::backtrace::trace_unsynchronized::hdc20954b281fa398
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x809d0a75c - std::sys_common::backtrace::_print_fmt::h851c3bb22d1bd14f
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:67:5
   3:        0x809d0a75c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h992bfab2808b9d2c
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:46:22
   4:        0x809d6533c - core::fmt::write::h4beeee5be6027630
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/fmt/mod.rs:1163:17
   5:        0x809cfad35 - std::io::Write::write_fmt::hbd0bd1c6adf0dd3a
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/io/mod.rs:1696:15
   6:        0x809d0d970 - std::sys_common::backtrace::_print::h595ca2cf59b93af6
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:49:5
   7:        0x809d0d970 - std::sys_common::backtrace::print::ha09b43169c9decf0
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:36:9
   8:        0x809d0d970 - std::panicking::default_hook::{{closure}}::hd9ad3eaee846e849
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:210:50
   9:        0x809d0d54b - std::panicking::default_hook::h7a7c077f048b8792
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:227:9
  10:        0x801eca654 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::he530e1db20d01541
  11:        0x809d0e118 - std::panicking::rust_panic_with_hook::hb040b83acf3f137e
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:628:17
  12:        0x809d0dbc2 - std::panicking::begin_panic_handler::{{closure}}::hfdbe47d5d1814ad3
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:519:13
  13:        0x809d0ac04 - std::sys_common::backtrace::__rust_end_short_backtrace::h4b51ac183bb8560f
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:139:18
  14:        0x809d0db59 - rust_begin_unwind
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:517:5
  15:        0x809cd2871 - core::panicking::panic_fmt::h4915ff406643e66f
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:100:14
  16:        0x809cd27bd - core::panicking::panic::hceb470b81ee5e370
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:50:5
  17:        0x806258f4d - rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_session::cstore::CrateStore for rustc_metadata::creader::CStore>::def_path_hash_to_def_id::ha831cdcb8279f8b1
  18:        0x805e5f799 - <rustc_query_impl::on_disk_cache::OnDiskCache as rustc_middle::ty::context::OnDiskCache>::def_path_hash_to_def_id::h9df2079a14be3f45
  19:        0x806cb6fde - rustc_middle::dep_graph::dep_node::<impl rustc_query_system::dep_graph::dep_node::DepNodeParams<rustc_middle::ty::context::TyCtxt> for rustc_span::def_id::DefId>::recover::h0be1ec7f2369aa4e
  20:        0x805d568dc - rustc_query_impl::query_callbacks::adt_def::force_from_dep_node::h5a827a651ceb7f4b
  21:        0x805dc8a3a - rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green::h246154e175b68f8a
  22:        0x805d8a5f0 - rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_green::hd5d777c24d30e6eb
  23:        0x805a310a9 - rustc_query_system::query::plumbing::ensure_must_run::hd578707044cfa8d0
  24:        0x805d6e57c - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_liveness::h9ecccfd91cac56ed
  25:        0x802006b17 - rustc_middle::hir::map::Map::for_each_module::he9354321183add89
  26:        0x8020dfcaf - rustc_session::utils::<impl rustc_session::session::Session>::time::h64ee4179782c7e9d
  27:        0x80201d2a3 - rustc_interface::passes::analysis::hafe53c6f463472d1
  28:        0x805d227f3 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h82ef7db05ecd9df5
  29:        0x805df165a - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h87bde42e8f100b15
  30:        0x805cdd2f5 - rustc_data_structures::stack::ensure_sufficient_stack::hfec16daa65da045b
  31:        0x805a79515 - rustc_query_system::query::plumbing::try_execute_query::h2ceb9b21adc7fe6b
  32:        0x805d6a8c5 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis::h20b8ecf2e134fdc0
  33:        0x801f47a34 - rustc_interface::passes::QueryContext::enter::h6e9a68780cfa1f49
  34:        0x801f1ae97 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h3c0234fc1ed6e0c7
  35:        0x801eddd21 - rustc_span::with_source_map::h24653b1f6aeb659e
  36:        0x801f1bc34 - rustc_interface::interface::create_compiler_and_run::h050aaf5624589b91
  37:        0x801eea363 - scoped_tls::ScopedKey<T>::set::h092456e7ef4a4dd2
  38:        0x801ede5b9 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4e3f92e0e4c9cd3c
  39:        0x801f49fe0 - core::ops::function::FnOnce::call_once{{vtable.shim}}::ha7b36f8d53cc6378
  40:        0x809d178d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h035c0499ebb170c5
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/alloc/src/boxed.rs:1691:9
  41:        0x809d178d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h284449b9578fabfe
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/alloc/src/boxed.rs:1691:9
  42:        0x809d178d3 - std::sys::unix::thread::Thread::new::thread_start::he9b38f275cae3559
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys/unix/thread.rs:106:17
  43:        0x80136882b - <unknown>

error: internal compiler error: unexpected panic

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.57.0 (f1edd0429 2021-11-29) running on x86_64-unknown-freebsd

note: compiler flags: -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 [analysis] running analysis passes on this crate
end of query stack

Not nightly, but given the others who are seeing this on nightly, I don't think it matters:

rustc --version
rustc 1.57.0 (f1edd0429 2021-11-29)

Good luck!

@Ryan1729
Copy link
Contributor

Ryan1729 commented Dec 18, 2021

I ran into this on rustc 1.57.0 (f1edd0429 2021-11-29). I then tried it on nightly, before finding this issue, and my project compiled successfully then. But the compiler still panicked on 1.57.0.

After running cargo clean it builds on 1.57.0 again, as others have reported.

@BGR360
Copy link
Contributor

BGR360 commented Dec 21, 2021

@rustbot label +A-incr-comp

@rustbot rustbot added the A-incr-comp Area: Incremental compilation label Dec 21, 2021
@theJasonFan
Copy link

I ran into this on rustc 1.58.1 (db9d1b20b 2022-01-20) after moving a struct from one module to its parent module. My project built after running cargo clean. Unfortunately, I cannot reproduce the issue and did not capture a backtrace. FWIW, I got the following error:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:18:85

@ahl
Copy link
Contributor Author

ahl commented Mar 2, 2022

Hit what looks to be the same bug again:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:18:85
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: <rustc_metadata::creader::CStore as rustc_session::cstore::CrateStore>::def_path_hash_to_def_id
   4: <rustc_middle::ty::context::TyCtxt>::def_path_hash_to_def_id
   5: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id
   6: rustc_query_impl::query_callbacks::adt_def::force_from_dep_node
   7: <rustc_middle::ty::context::TyCtxt as rustc_query_system::dep_graph::DepContext>::try_force_from_dep_node
   8: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
   9: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  10: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_green::<rustc_query_impl::plumbing::QueryCtxt>
  11: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>
  12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>>
  13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::unsafety_check_result, rustc_query_impl::plumbing::QueryCtxt>
  14: <rustc_mir_transform::check_unsafety::UnsafetyChecker as rustc_middle::mir::visit::Visitor>::visit_rvalue
  15: rustc_mir_transform::check_unsafety::unsafety_check_result
  16: <rustc_mir_transform::check_unsafety::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  17: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>
  18: rustc_data_structures::stack::ensure_sufficient_stack::<(&rustc_middle::mir::query::UnsafetyCheckResult, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>::{closure#3}>
  19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>>
  20: rustc_query_system::query::plumbing::force_query::<rustc_query_impl::queries::unsafety_check_result, rustc_query_impl::plumbing::QueryCtxt>
  21: rustc_query_impl::query_callbacks::unsafety_check_result::force_from_dep_node
  22: <rustc_middle::ty::context::TyCtxt as rustc_query_system::dep_graph::DepContext>::try_force_from_dep_node
  23: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  24: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  25: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  26: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  27: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_green::<rustc_query_impl::plumbing::QueryCtxt>
  28: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::DefId, &rustc_middle::ty::TyS>
  29: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, &rustc_middle::ty::TyS>>
  30: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt>
  31: rustc_typeck::check::check::check_item_type
  32: <rustc_middle::hir::map::Map>::visit_item_likes_in_module::<rustc_typeck::check::CheckItemTypesVisitor>
  33: rustc_typeck::check::check::check_mod_item_types
  34: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, ()>
  35: rustc_data_structures::stack::ensure_sufficient_stack::<((), rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, ()>::{closure#3}>
  36: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, ()>>
  37: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
  38: <rustc_middle::hir::map::Map>::for_each_module::<rustc_typeck::check_crate::{closure#6}::{closure#0}>
  39: <rustc_session::session::Session>::time::<(), rustc_typeck::check_crate::{closure#6}>
  40: rustc_typeck::check_crate
  41: rustc_interface::passes::analysis
  42: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>
  43: rustc_data_structures::stack::ensure_sufficient_stack::<(core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#3}>
  44: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
  45: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  46: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>
  47: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
  48: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  49: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>
  50: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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.58.0-nightly (65c55bf93 2021-11-23) running on x86_64-apple-darwin

note: compiler flags: -C panic=abort -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [unsafety_check_result] unsafety-checking `results_sink::{closure#0}`
#1 [unsafety_check_result] unsafety-checking `results_sink`
#2 [type_of] computing type of `results_sink::{opaque#0}`
#3 [check_mod_item_types] checking item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack

@davepacheco
Copy link

I'm running into a similar issue:

$ cargo test
   Compiling omicron-nexus v0.1.0 (/home/dap/omicron-auth/nexus)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/65c55bf931a55e6b1e5ed14ad8623814a7386424/compiler/rustc_hir/src/definitions.rs:452:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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.58.0-nightly (65c55bf93 2021-11-23) running on x86_64-unknown-illumos

note: compiler flags: -C panic=abort -C embed-bitcode=no -C debuginfo=2 -C incremental -C link-arg=-Wl,-R/opt/ooce/pgsql-13/lib/amd64 --crate-type lib

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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `for<'c> fn(steno::saga_exec::ActionContext<sagas::SagaInstanceCreate>) -> impl Future<Output = core::result::Result<(), anyhow::Error>> {sagas::sic_delete_instance_record}: steno::saga_action_func::ActionFn<'c, sagas::SagaInstanceCreate>`
#1 [codegen_fulfill_obligation] checking if `core::ops::unsize::CoerceUnsized` fulfills its obligations
end of query stack
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/65c55bf931a55e6b1e5ed14ad8623814a7386424/compiler/rustc_hir/src/definitions.rs:452:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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.58.0-nightly (65c55bf93 2021-11-23) running on x86_64-unknown-illumos

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C link-arg=-Wl,-R/opt/ooce/pgsql-13/lib/amd64 --crate-type lib

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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `for<'c> fn(steno::saga_exec::ActionContext<sagas::SagaInstanceCreate>) -> impl Future<Output = core::result::Result<(), anyhow::Error>> {sagas::sic_delete_instance_record}: steno::saga_action_func::ActionFn<'c, sagas::SagaInstanceCreate>`
#1 [codegen_fulfill_obligation] checking if `core::ops::unsize::CoerceUnsized` fulfills its obligations
end of query stack
error: could not compile `omicron-nexus`
warning: build failed, waiting for other jobs to finish...
error: build failed

It seems to be totally reproducible. It sounds from what others have said that there's some local state associated with the problem. I'd keep around the state in case it was useful...but it seems like nobody's actively looking at this so I've tried the cargo clean and cargo test workaround and that worked. If there's information that would be useful to gather when this happens again, let me know.

@theJasonFan
Copy link

theJasonFan commented Apr 27, 2022

FWIW, I have run into this issue multiple times and have observed that this error may happen when modules are re-factored and moved around.

e.g. I believe I have hit this error when I do something like: move a module crate::foo in /src/foo.rs to some other location, say, crate::bar::foo implemented in /src/bar/foo.rs and recompile with cargo.

Indeed, cargo clean always fixes the issue.

@kpreid
Copy link
Contributor

kpreid commented Dec 25, 2023

Triage: Relabeling issues which don't have a runnable reproduction (as opposed to having a non-minimized one) to the new label S-needs-repro.
@rustbot label +S-needs-repro -E-needs-mcve

@rustbot rustbot added S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Dec 25, 2023
@Noratrieb
Copy link
Member

This issue does not have a reproduction and is therefore not really actionable, closing. If you find the problem again, please open a new issue, ideally with a reproduction.

@Noratrieb Noratrieb closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. 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