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

RustDoc panics at 'no entry found for key' when documenting code that implements the acpi::AcpiHandler trait #104421

Closed
hawkw opened this issue Nov 14, 2022 · 2 comments
Labels
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

@hawkw
Copy link
Contributor

hawkw commented Nov 14, 2022

When documenting code that depends on the acpi crate and contains a type which implements the AcpiHandler trait from acpi, RustDoc panics with the message 'no entry found for key'.

This panic appears to be quite similar to the one described in issue #103463. However, the commit fixing that issue was merged in #103649 (12 days ago), and this panic is still reproducible on the latest nightly (e631891 2022-11-13), while the panic with the luminance crate described by #103463 is not reproducible on the latest nightly. Additionally, unlike #103463, simply useing acpi::AcpiHandler is not sufficient to cause the panic; the crate that depends on acpi must actually implement the trait in order to cause RustDoc to panic. Therefore, I thought this seemed like it deserved a separate issue from #103463.

Code

Cargo.toml:

[package]
name = "rustdoc-panic-repro"
version = "0.1.0"
edition = "2021"

[dependencies]
acpi = "4"

lib.rs

#[derive(Clone)]
struct MyAcpiHandler;

impl acpi::AcpiHandler for MyAcpiHandler {
    unsafe fn map_physical_region<T>(&self, _: usize, _: usize) -> acpi::PhysicalMapping<Self, T> {
        unimplemented!()
    }
    fn unmap_physical_region<T>(_: &acpi::PhysicalMapping<Self, T>) {
        unimplemented!()
    }
}

A Git repository containing the reproduction is also available here: https://github.com/hawkw/rustdoc-panic-repro

Meta

rustc --version --verbose:

rustc 1.67.0-nightly (e631891f7 2022-11-13)
binary: rustc
commit-hash: e631891f7ad40eac3ef58ec3c2b57ecd81e40615
commit-date: 2022-11-13
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Error output

$ cargo doc
 Documenting rustdoc-panic-repro v0.1.0 (/home/eliza/Code/rustdoc-panic-repro)
thread 'rustc' panicked at 'no entry found for key', src/librustdoc/passes/collect_intra_doc_links.rs:782:16
stack backtrace:
  <snip, see details>
Backtrace

thread 'rustc' panicked at 'no entry found for key', src/librustdoc/passes/collect_intra_doc_links.rs:782:16
stack backtrace:
   0:     0x7fb307758e40 - std::backtrace_rs::backtrace::libunwind::trace::he4d5f2c13fd7ea58
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fb307758e40 - std::backtrace_rs::backtrace::trace_unsynchronized::ha872462b0d7f1993
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb307758e40 - std::sys_common::backtrace::_print_fmt::hfa57ea34975e92c8
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fb307758e40 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdf4fb6a2aa638ae6
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fb3077bb2fe - core::fmt::write::h556296da8255a0fe
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/core/src/fmt/mod.rs:1209:17
   5:     0x7fb307749185 - std::io::Write::write_fmt::h1e63bc45d9e0b177
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/io/mod.rs:1682:15
   6:     0x7fb307758c05 - std::sys_common::backtrace::_print::h18ecb2198a8971d0
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fb307758c05 - std::sys_common::backtrace::print::he62f784f6f099fe2
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fb30775b9af - std::panicking::default_hook::{{closure}}::h220c4bc545c14f7e
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/panicking.rs:267:22
   9:     0x7fb30775b6ea - std::panicking::default_hook::hc6a46490400a51ce
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/panicking.rs:286:9
  10:     0x7fb30775c1bc - std::panicking::rust_panic_with_hook::hec8b21fa74280350
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/panicking.rs:688:13
  11:     0x7fb30775bf57 - std::panicking::begin_panic_handler::{{closure}}::hfc7a6bbbe087d67f
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/panicking.rs:579:13
  12:     0x7fb3077592ec - std::sys_common::backtrace::__rust_end_short_backtrace::h9522cd483b462760
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7fb30775bc72 - rust_begin_unwind
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/panicking.rs:575:5
  14:     0x7fb3077b7cd3 - core::panicking::panic_fmt::hed336b84331644c6
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/core/src/panicking.rs:65:14
  15:     0x7fb3077b7e21 - core::panicking::panic_display::hfd9196fe7e39c556
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/core/src/panicking.rs:139:5
  16:     0x7fb3077b7dcb - core::panicking::panic_str::h690ea6362ec322ca
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/core/src/panicking.rs:123:5
  17:     0x7fb3077b7a46 - core::option::expect_failed::ha7492c08770f6013
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/core/src/option.rs:1879:5
  18:     0x55fef72a2d84 - rustdoc[c1dc24f96e9fc78e]::passes::collect_intra_doc_links::resolve_associated_trait_item
  19:     0x55fef72a1ab0 - <rustdoc[c1dc24f96e9fc78e]::passes::collect_intra_doc_links::LinkCollector>::resolve_associated_item
  20:     0x55fef729ff25 - <rustdoc[c1dc24f96e9fc78e]::passes::collect_intra_doc_links::LinkCollector>::resolve
  21:     0x55fef72a47c3 - <rustdoc[c1dc24f96e9fc78e]::passes::collect_intra_doc_links::LinkCollector as rustdoc[c1dc24f96e9fc78e]::visit::DocVisitor>::visit_item
  22:     0x55fef729e6e1 - rustdoc[c1dc24f96e9fc78e]::passes::collect_intra_doc_links::collect_intra_doc_links
  23:     0x55fef7458b6d - <rustc_session[137af93febc05af8]::session::Session>::time::<rustdoc[c1dc24f96e9fc78e]::clean::types::Crate, rustdoc[c1dc24f96e9fc78e]::core::run_global_ctxt::{closure#7}>
  24:     0x55fef7286730 - rustdoc[c1dc24f96e9fc78e]::core::run_global_ctxt
  25:     0x55fef745b66b - <rustc_interface[c45a0c7151d607d6]::passes::QueryContext>::enter::<rustdoc[c1dc24f96e9fc78e]::main_args::{closure#1}::{closure#0}::{closure#1}, core[8ea5df1f30b7f766]::result::Result<(), rustc_errors[858123638ecad7e2]::ErrorGuaranteed>>
  26:     0x55fef7337e44 - <rustc_interface[c45a0c7151d607d6]::interface::Compiler>::enter::<rustdoc[c1dc24f96e9fc78e]::main_args::{closure#1}::{closure#0}, core[8ea5df1f30b7f766]::result::Result<(), rustc_errors[858123638ecad7e2]::ErrorGuaranteed>>
  27:     0x55fef7265b13 - std[772581ffc1b79bff]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c45a0c7151d607d6]::util::run_in_thread_pool_with_globals<rustc_interface[c45a0c7151d607d6]::interface::run_compiler<core[8ea5df1f30b7f766]::result::Result<(), rustc_errors[858123638ecad7e2]::ErrorGuaranteed>, rustdoc[c1dc24f96e9fc78e]::main_args::{closure#1}>::{closure#0}, core[8ea5df1f30b7f766]::result::Result<(), rustc_errors[858123638ecad7e2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8ea5df1f30b7f766]::result::Result<(), rustc_errors[858123638ecad7e2]::ErrorGuaranteed>>
  28:     0x55fef756b5e4 - <<std[772581ffc1b79bff]::thread::Builder>::spawn_unchecked_<rustc_interface[c45a0c7151d607d6]::util::run_in_thread_pool_with_globals<rustc_interface[c45a0c7151d607d6]::interface::run_compiler<core[8ea5df1f30b7f766]::result::Result<(), rustc_errors[858123638ecad7e2]::ErrorGuaranteed>, rustdoc[c1dc24f96e9fc78e]::main_args::{closure#1}>::{closure#0}, core[8ea5df1f30b7f766]::result::Result<(), rustc_errors[858123638ecad7e2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8ea5df1f30b7f766]::result::Result<(), rustc_errors[858123638ecad7e2]::ErrorGuaranteed>>::{closure#1} as core[8ea5df1f30b7f766]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7fb307765f73 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb9beccc25c64a001
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/alloc/src/boxed.rs:2000:9
  30:     0x7fb307765f73 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hde98428e87ac1a81
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/alloc/src/boxed.rs:2000:9
  31:     0x7fb307765f73 - std::sys::unix::thread::Thread::new::thread_start::h2ef156d73deb51c1
                               at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/sys/unix/thread.rs:108:17
  32:     0x7fb3074b0e86 - start_thread
  33:     0x7fb307537c60 - __clone3
  34:                0x0 - <unknown>
error: could not document `rustdoc-panic-repro`

@hawkw hawkw 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 14, 2022
@hawkw
Copy link
Contributor Author

hawkw commented Nov 14, 2022

Oh, whoops, this looks like it might be a duplicate of #104145. I'll wait and see if PR #104364 fixes this panic as well, and if it does, this can be closed as a duplicate of #104145. My bad!

@hawkw
Copy link
Contributor Author

hawkw commented Nov 16, 2022

Looks like nightly-2022-11-16 fixes this, so it's almost certainly a duplicate of #104145. Sorry for the noise!

@hawkw hawkw closed this as completed Nov 16, 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) ❄️ 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

1 participant