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

Option::unwrap() on a None value in compiler/rustc_middle/src/ty/query/mod.rs #80049

Closed
Darksonn opened this issue Dec 15, 2020 · 2 comments
Closed
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Darksonn
Copy link
Contributor

I encountered the backtrace that you can find below when compiling the documentation for Tokio. Unfortunately I am not able to provide a reproducible example because the panic appears to have been caused by the specific state of the incremental artifacts in the target/ directory when compiling the code.

The error was triggered after having performed a git switch some-other-branch from one version of the code to another. I don't think this checkout has modified any code in the tokio-test crate.

The compiler version in question was rustc 1.50.0-nightly (3d6705aa5 2020-12-07) running on Arch Linux. The error is persisted if I run the command several times, but both upgrading rustc and deleting target/ makes it go away. I assume that upgrading rustc doesn't trigger it because it doesn't try to reuse the old artifacts, which is why I submitted this even though I could not trigger it after upgrading.

Backtrace

tokio $ RUST_BACKTRACE=1 RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features 
warning: output filename collision.
The lib target `pin-project-lite` in package `pin-project-lite v0.2.0` has the same output filename as the lib target `pin-project-lite` in package `pin-project-lite v0.1.10`.
Colliding filename is: /home/alice/src/tokio/target/doc/pin_project_lite/index.html
The targets should have unique names.
This is a known bug where multiple crates with the same name use
the same path; see <https://github.com/rust-lang/cargo/issues/6313>.
    Checking tokio-test v0.4.0 (/home/alice/src/tokio/tokio-test)
 Documenting tokio-test v0.4.0 (/home/alice/src/tokio/tokio-test)
 Documenting tokio-util v0.6.0 (/home/alice/src/tokio/tokio-util)
 Documenting tests-build v0.1.0 (/home/alice/src/tokio/tests-build)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_middle/src/ty/query/mod.rs:235:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/panicking.rs:50:5
   3: rustc_middle::ty::query::try_load_from_on_disk_cache
   4: rustc_query_system::dep_graph::graph::DepGraph<K>::exec_cache_promotions
   5: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
   6: rustc_incremental::persist::save::save_in
   7: rustc_data_structures::sync::join
   8: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
   9: rustc_incremental::persist::save::save_dep_graph
  10: rustc_codegen_ssa::base::finalize_tcx
  11: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  12: rustc_session::utils::<impl rustc_session::session::Session>::time
  13: rustc_interface::passes::QueryContext::enter
  14: rustc_interface::queries::Queries::ongoing_codegen
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: rustc_interface::interface::create_compiler_and_run
  18: 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.50.0-nightly (3d6705aa5 2020-12-07) 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:
end of query stack
error: could not compile `tokio-test`

I hope that the above panic backtrace is enough that you can figure out what went wrong, because if not, then I'm sorry but I can't reproduce it.

@Darksonn Darksonn 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 Dec 15, 2020
@taiki-e
Copy link
Member

taiki-e commented Dec 15, 2020

I think this is a duplicate of #79661, this should be fixed on the latest nightly.

@jyn514 jyn514 added the A-incr-comp Area: Incremental compilation label Dec 15, 2020
@jyn514
Copy link
Member

jyn514 commented Dec 15, 2020

both upgrading rustc and deleting target/ makes it go away

I think this is probably fixed by #79721; feel free to re-open if you run into this again.

@jyn514 jyn514 closed this as completed Dec 15, 2020
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) ❄️ 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