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 'no entry found for key', src/librustdoc/passes/collect_intra_doc_links.rs:986:16 #96429

Closed
jcornaz opened this issue Apr 26, 2022 · 1 comment · Fixed by #96447
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@jcornaz
Copy link

jcornaz commented Apr 26, 2022

Code

Here is a complete (minimized) reproducer: https://github.com/jcornaz/rustdoc-bug-reproducer

It can be reproduced with a workspace with two crates "a" and "b" where:

  • The crate "a" depends on the public (crates.io) crate rapier2d and its code is: pub extern crate rapier2d.
  • The crate "b" depends on the workspace crate a and its code is: pub extern crate a; pub use a::*;

With that setup, the command cargo doc rightfully succeeds using the stable toolchain. But fails when using the latest (2022-04-25) nightly toolchain.

Meta

The bug is observable on nightly only (works fine on stable, and beta)

rustc --version --verbose:

rustc 1.62.0-nightly (055bf4ccd 2022-04-25)
binary: rustc
commit-hash: 055bf4ccd521c2c2185166c86951be7be145727c
commit-date: 2022-04-25
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1

Error output

thread 'rustc' panicked at 'no entry found for key', src/librustdoc/passes/collect_intra_doc_links.rs:986:16
stack backtrace:
   0:     0x7f7403e9dfbd - std::backtrace_rs::backtrace::libunwind::trace::h255d949666e58f6b
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f7403e9dfbd - std::backtrace_rs::backtrace::trace_unsynchronized::h59be33441d121d1d
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7403e9dfbd - std::sys_common::backtrace::_print_fmt::h6816fd3d27a9a377
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f7403e9dfbd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h82ff7ad0f9b6d219
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f7403ef9d3c - core::fmt::write::hdc2f5d52c343c037
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/fmt/mod.rs:1194:17
   5:     0x7f7403e8f751 - std::io::Write::write_fmt::h6630625e1b3b8549
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/io/mod.rs:1655:15
   6:     0x7f7403ea0cd5 - std::sys_common::backtrace::_print::h079fc1ab3c6afc34
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f7403ea0cd5 - std::sys_common::backtrace::print::h15ede9f080adb086
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f7403ea0cd5 - std::panicking::default_hook::{{closure}}::hab27a4086947747e
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/panicking.rs:295:22
   9:     0x7f7403ea0949 - std::panicking::default_hook::h1c34f54634258465
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/panicking.rs:314:9
  10:     0x7f74046ce631 - rustc_driver[5b352b26ad3dfe5c]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f7403ea14a6 - std::panicking::rust_panic_with_hook::h0dc181d44ee5ed0c
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/panicking.rs:702:17
  12:     0x7f7403ea12a7 - std::panicking::begin_panic_handler::{{closure}}::h875b756428b20e02
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/panicking.rs:588:13
  13:     0x7f7403e9e474 - std::sys_common::backtrace::__rust_end_short_backtrace::hc9cd3566ed60bf46
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f7403ea0fd9 - rust_begin_unwind
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/panicking.rs:584:5
  15:     0x7f7403e662d3 - core::panicking::panic_fmt::hf36b3eaa51f439da
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/panicking.rs:142:14
  16:     0x7f7403ef69a1 - core::panicking::panic_display::h77d1e09bd8e55215
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/panicking.rs:72:5
  17:     0x7f7403ef694b - core::panicking::panic_str::hafb3b5aec7caf416
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/panicking.rs:56:5
  18:     0x7f7403e66146 - core::option::expect_failed::he734f89dd05e1da9
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/option.rs:1855:5
  19:     0x55ad4c0ab069 - rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::resolve_associated_trait_item
  20:     0x55ad4c0a980e - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector>::resolve_associated_item
  21:     0x55ad4c0a69a5 - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector>::resolve
  22:     0x55ad4c0acda1 - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_item
  23:     0x55ad4c0bf05a - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_inner_recur
  24:     0x55ad4c0b03a2 - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_item
  25:     0x55ad4c0bf0fa - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_inner_recur
  26:     0x55ad4c0b0387 - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_item
  27:     0x55ad4c0bf0fa - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_inner_recur
  28:     0x55ad4c0b0387 - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_item
  29:     0x55ad4c0bf0fa - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_inner_recur
  30:     0x55ad4c0b0387 - <rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c740e608ce4065c7]::visit::DocVisitor>::visit_item
  31:     0x55ad4c0a4d3c - rustdoc[c740e608ce4065c7]::passes::collect_intra_doc_links::collect_intra_doc_links
  32:     0x55ad4c119b73 - <rustc_interface[e9d0a11aa8a8a3c0]::passes::QueryContext>::enter::<rustdoc[c740e608ce4065c7]::main_options::{closure#0}::{closure#0}::{closure#1}, core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>>::{closure#0}
  33:     0x55ad4c0f9bd0 - <rustc_interface[e9d0a11aa8a8a3c0]::passes::QueryContext>::enter::<rustdoc[c740e608ce4065c7]::main_options::{closure#0}::{closure#0}::{closure#1}, core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>>
  34:     0x55ad4c04468f - <rustc_interface[e9d0a11aa8a8a3c0]::interface::Compiler>::enter::<rustdoc[c740e608ce4065c7]::main_options::{closure#0}::{closure#0}, core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>>
  35:     0x55ad4becca8a - rustc_span[96ab0c074c70a392]::with_source_map::<core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>, rustc_interface[e9d0a11aa8a8a3c0]::interface::create_compiler_and_run<core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>, rustdoc[c740e608ce4065c7]::main_options::{closure#0}>::{closure#1}>
  36:     0x55ad4c06c4c4 - rustc_interface[e9d0a11aa8a8a3c0]::interface::create_compiler_and_run::<core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>, rustdoc[c740e608ce4065c7]::main_options::{closure#0}>
  37:     0x55ad4becf807 - <scoped_tls[80262534c33ca282]::ScopedKey<rustc_span[96ab0c074c70a392]::SessionGlobals>>::set::<rustdoc[c740e608ce4065c7]::main_args::{closure#0}, core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>>
  38:     0x55ad4c06cc9f - std[e64a7aad70b6f3c5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e9d0a11aa8a8a3c0]::util::run_in_thread_pool_with_globals<rustdoc[c740e608ce4065c7]::main_args::{closure#0}, core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>>::{closure#0}, core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>>
  39:     0x55ad4c11c1a9 - <<std[e64a7aad70b6f3c5]::thread::Builder>::spawn_unchecked_<rustc_interface[e9d0a11aa8a8a3c0]::util::run_in_thread_pool_with_globals<rustdoc[c740e608ce4065c7]::main_args::{closure#0}, core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>>::{closure#0}, core[e5e8ff07e69a7713]::result::Result<(), rustc_errors[64e578492efe301e]::ErrorGuaranteed>>::{closure#1} as core[e5e8ff07e69a7713]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7f7403eab3f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2990d8a21034a815
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/alloc/src/boxed.rs:1866:9
  41:     0x7f7403eab3f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4dfad1b93e043110
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/alloc/src/boxed.rs:1866:9
  42:     0x7f7403eab3f3 - std::sys::unix::thread::Thread::new::thread_start::h62b554408c95900f
                               at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/sys/unix/thread.rs:108:17
  43:     0x7f7403c835c2 - start_thread
  44:     0x7f7403d08584 - __clone
  45:                0x0 - <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.62.0-nightly (055bf4ccd 2022-04-25) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib
Backtrace

thread 'rustc' panicked at 'no entry found for key', src/librustdoc/passes/collect_intra_doc_links.rs:986:16
stack backtrace:
   0: rust_begin_unwind
             at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_display
             at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/panicking.rs:72:5
   3: core::panicking::panic_str
             at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/panicking.rs:56:5
   4: core::option::expect_failed
             at /rustc/055bf4ccd521c2c2185166c86951be7be145727c/library/core/src/option.rs:1855:5
   5: rustdoc::passes::collect_intra_doc_links::resolve_associated_trait_item
   6: <rustdoc::passes::collect_intra_doc_links::LinkCollector>::resolve_associated_item
   7: <rustdoc::passes::collect_intra_doc_links::LinkCollector>::resolve
   8: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_item
   9: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_inner_recur
  10: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_item
  11: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_inner_recur
  12: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_item
  13: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_inner_recur
  14: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_item
  15: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_inner_recur
  16: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_item
  17: rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links
  18: <rustc_interface::passes::QueryContext>::enter::<rustdoc::main_options::{closure#0}::{closure#0}::{closure#1}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}
  19: <rustc_interface::passes::QueryContext>::enter::<rustdoc::main_options::{closure#0}::{closure#0}::{closure#1}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  20: <rustc_interface::interface::Compiler>::enter::<rustdoc::main_options::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  21: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustdoc::main_options::{closure#0}>::{closure#1}>
  22: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustdoc::main_options::{closure#0}>
  23: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustdoc::main_args::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@jcornaz jcornaz 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 Apr 26, 2022
@petrochenkov petrochenkov self-assigned this Apr 26, 2022
@petrochenkov
Copy link
Contributor

Fixed in #96447.

@Mark-Simulacrum Mark-Simulacrum added this to the 1.62.0 milestone May 3, 2022
@Mark-Simulacrum Mark-Simulacrum added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label May 3, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 3, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this issue May 3, 2022
rustdoc: Resolve doc links on fields during early resolution

Another subset of rust-lang#94857 which fixes rust-lang#96429.

This case regressed in rust-lang#96135 when `may_have_doc_links`-based filtering was introduced.
Before that filtering structs could collect traits in scope for their fields, but after the filtering structs won't collect anything if they don't have doc comments on them, so we have to visit fields too.
@bors bors closed this as completed in 21d613b May 4, 2022
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 4, 2022
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants