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' #89209

Closed
schneiderfelipe opened this issue Sep 23, 2021 · 4 comments
Closed
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

@schneiderfelipe
Copy link

Unfortunately, I don't have a code example to share, but here's the output:

Error output

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

Meta

rustc --version --verbose:

rustc 1.57.0-nightly (308dffd25 2021-09-22)
binary: rustc
commit-hash: 308dffd25cb55bbb4a1fbee9822cf82c6a5d012d
commit-date: 2021-09-22
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0
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
             at /rustc/308dffd25cb55bbb4a1fbee9822cf82c6a5d012d/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/308dffd25cb55bbb4a1fbee9822cf82c6a5d012d/library/core/src/panicking.rs:103:14
   2: core::panicking::panic
             at /rustc/308dffd25cb55bbb4a1fbee9822cf82c6a5d012d/library/core/src/panicking.rs:50:5
   3: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_middle::middle::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.

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-nightly (308dffd25 2021-09-22) running on x86_64-unknown-linux-gnu

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

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

@schneiderfelipe schneiderfelipe 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 Sep 23, 2021
@workingjubilee
Copy link
Member

Should this function be fallible?

pub fn def_path_hash_to_def_index(&self, def_path_hash: &DefPathHash) -> DefIndex {
match *self {
DefPathHashMapRef::OwnedFromMetadata(ref map) => map.get(def_path_hash).unwrap(),
DefPathHashMapRef::BorrowedFromTcx(_) => {
panic!("DefPathHashMap::BorrowedFromTcx variant only exists for serialization")
}
}
}

@estebank estebank added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Sep 24, 2021
@Aaron1011
Copy link
Member

cc @michaelwoerister

@bishtpawan
Copy link
Contributor

What do we need to return here in an error case then? Or I guess we can use expect directly with the error message right?

@Enselic
Copy link
Member

Enselic commented Sep 10, 2023

Triage: Let's close this since there is no known way to reproduce.

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 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. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

6 participants