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

cargo doc panicked at 'no entry found for key' #9136

Closed
ComputerDruid opened this issue Feb 5, 2021 · 1 comment · Fixed by #9142
Closed

cargo doc panicked at 'no entry found for key' #9136

ComputerDruid opened this issue Feb 5, 2021 · 1 comment · Fixed by #9142
Assignees
Labels
C-bug Category: bug Command-doc regression-from-stable-to-nightly Regression in nightly that previously worked in stable.

Comments

@ComputerDruid
Copy link

ComputerDruid commented Feb 5, 2021

Problem
Cargo crashes when running cargo doc --target x86_64-fuchsia

Expected behavior: doesn't crash and produces documentation 😄

Steps

  1. cargo init example
  2. Replace Cargo.toml with:
[package]
name = "example"
version = "0.0.1"
edition = "2018"

[dependencies."rand_6"]
package = "rand"
version = "0.6.5"

[dependencies."rand_7"]
package = "rand"
version = "0.7.2"
  1. cargo +nightly doc --target=x86_64-fuchsia

Produces:

thread 'main' panicked at 'no entry found for key', src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs:324:9
stack backtrace:
   0:     0x556606f338f7 - std::backtrace_rs::backtrace::libunwind::trace::h8bc78f7bc1f75bdb
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x556606f338f7 - std::backtrace_rs::backtrace::trace_unsynchronized::ha4c961c9576f95ba
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x556606f338f7 - std::sys_common::backtrace::_print_fmt::hc20cfdc233d6eb02
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x556606f338f7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h04bea14549780a0f
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x556606f5abbc - core::fmt::write::h3868db8542c90941
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/core/src/fmt/mod.rs:1096:17
   5:     0x556606f2ae42 - std::io::Write::write_fmt::h55dd75636eef6a5c
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/io/mod.rs:1568:15
   6:     0x556606f36915 - std::sys_common::backtrace::_print::h6439e8525077c7da
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x556606f36915 - std::sys_common::backtrace::print::h02b685f728ce3931
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x556606f36915 - std::panicking::default_hook::{{closure}}::h7c29625065fafae1
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/panicking.rs:208:50
   9:     0x556606f36473 - std::panicking::default_hook::hba441710bb71f4d5
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/panicking.rs:225:9
  10:     0x556606f370b1 - std::panicking::rust_panic_with_hook::ha936eb00e51bc4d9
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/panicking.rs:591:17
  11:     0x556606f36bf7 - std::panicking::begin_panic_handler::{{closure}}::hcd15140e0238536e
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/panicking.rs:497:13
  12:     0x556606f33dbc - std::sys_common::backtrace::__rust_end_short_backtrace::hb13a021bb64823a1
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x556606f36b59 - rust_begin_unwind
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/panicking.rs:493:5
  14:     0x556606f592a1 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/core/src/panicking.rs:92:14
  15:     0x556606f59033 - core::option::expect_failed::h8be1ca96ca0d69ca
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/core/src/option.rs:1292:5
  16:     0x5566066ada0e - cargo::core::compiler::context::Context::outputs::haa957a7b0e56a222
  17:     0x5566066a98e8 - cargo::core::compiler::context::Context::compile::h619f9454e2bb6dde
  18:     0x5566068d840e - cargo::ops::cargo_compile::compile_ws::h1c44fcf7dadb06cb
  19:     0x5566068d815d - cargo::ops::cargo_compile::compile::h68cd9fa4cc2c1bbf
  20:     0x5566068e5e78 - cargo::ops::cargo_doc::doc::h19eb2ebb797f577c
  21:     0x5566065a7647 - cargo::commands::doc::exec::h953a6e3d8d6ae36b
  22:     0x55660657a7b2 - cargo::cli::main::h92989bace6d3806b
  23:     0x5566065e2be8 - cargo::main::ha1183bac4403fd4f
  24:     0x5566065d4116 - std::sys_common::backtrace::__rust_begin_short_backtrace::h03f0492d76360063
  25:     0x5566065d413c - std::rt::lang_start::{{closure}}::hbe0ff8cdce754e4d
  26:     0x556606f375c7 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h7c92107c3c98a949
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/core/src/ops/function.rs:259:13
  27:     0x556606f375c7 - std::panicking::try::do_call::h7454c57e8fbf0cc1
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/panicking.rs:379:40
  28:     0x556606f375c7 - std::panicking::try::he71cdc15ed83b5ec
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/panicking.rs:343:19
  29:     0x556606f375c7 - std::panic::catch_unwind::hfc08ddb043e6e18c
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/panic.rs:410:14
  30:     0x556606f375c7 - std::rt::lang_start_internal::he4958117ec6901fd
                               at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/std/src/rt.rs:51:25
  31:     0x5566065e4f35 - main
  32:     0x7fc4d5088d0a - __libc_start_main
  33:     0x55660656e071 - <unknown>

Notes

Output of cargo version:

$ cargo +nightly version
cargo 1.51.0-nightly (c3abcfe8a 2021-01-25)

rustup +nightly target add x86_64-fuchsia is probably required to get it to actually work, but does not seem necessary to reproduce the bug.

Also, it works fine on stable:

$ cargo +stable doc --target=x86_64-fuchsia
    Finished dev [unoptimized + debuginfo] target(s) in 6.43s
$ cargo +stable version
cargo 1.49.0 (d00d64df9 2020-12-05)

So this is a regression.

The original failure I saw did not involve rename imports, but I switched to rename imports to show that just having both versions of rand in the graph is enough to trigger the problem. The original example I saw depended on rand 0.6 directly and tempfile which brought in rand 0.7.

@ComputerDruid ComputerDruid added the C-bug Category: bug label Feb 5, 2021
@ehuss
Copy link
Contributor

ehuss commented Feb 5, 2021

Thanks for the report! This appears to be a regression caused by #9077. I will try to take a look.

@ehuss ehuss self-assigned this Feb 5, 2021
@ehuss ehuss added Command-doc regression-from-stable-to-nightly Regression in nightly that previously worked in stable. labels Feb 5, 2021
@bors bors closed this as completed in 90b6fa8 Feb 5, 2021
ehuss pushed a commit to ehuss/cargo that referenced this issue Feb 22, 2021
Fix panic with doc collision orphan.

As I feared, the collision removal added in rust-lang#9077 caused problems due to orphans left in the unit graph. Ironically, it was the collision warning detection code which failed, as it iterates over all the keys of the graph.

The solution is to remove all orphans from the graph after collisions have been removed.

Fixes rust-lang#9136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-doc regression-from-stable-to-nightly Regression in nightly that previously worked in stable.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants