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

Compiler error on nightly cargo doc invocation on fltk-rs repository #96079

Closed
64kramsystem opened this issue Apr 15, 2022 · 5 comments · Fixed by #96135
Closed

Compiler error on nightly cargo doc invocation on fltk-rs repository #96079

64kramsystem opened this issue Apr 15, 2022 · 5 comments · Fixed by #96135
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@64kramsystem
Copy link

Code

$ git clone https://github.com/fltk-rs/fltk-rs.git
$ git checkout a0402da3d160f55a5d41b1a8daec3d7a41f58fbc
$ cargo doc

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (e7575f967 2022-04-14)
binary: rustc
commit-hash: e7575f9670f3c837def3d186ae09366c75c7632e
commit-date: 2022-04-14
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0

Error output

(The whole backtrace is printed anyway, so I'm posting only the cargo doc output:

 Documenting fltk v1.3.5 (/tmp/fltk-rs/fltk)
thread 'rustc' panicked at 'no entry found for key', src/librustdoc/passes/collect_intra_doc_links.rs:976:16
stack backtrace:
   0:     0x7fcd713e496d - std::backtrace_rs::backtrace::libunwind::trace::h391ee3eb96720bb8
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fcd713e496d - std::backtrace_rs::backtrace::trace_unsynchronized::h8ac766d4ecc4f21c
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fcd713e496d - std::sys_common::backtrace::_print_fmt::h67120ae1638604b6
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fcd713e496d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h43d9264c5edad28c
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fcd7143efec - core::fmt::write::hb38509135e81eb46
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/core/src/fmt/mod.rs:1194:17
   5:     0x7fcd713d60c1 - std::io::Write::write_fmt::h68856f209e22f0a1
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/io/mod.rs:1655:15
   6:     0x7fcd713e7685 - std::sys_common::backtrace::_print::h2f4ffd98d72d3d6b
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fcd713e7685 - std::sys_common::backtrace::print::hca608482b4ab8751
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fcd713e7685 - std::panicking::default_hook::{{closure}}::h9ed02f27942ac2ac
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/panicking.rs:295:22
   9:     0x7fcd713e72f9 - std::panicking::default_hook::h632f45ebccdd2f92
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/panicking.rs:314:9
  10:     0x7fcd71b88051 - rustc_driver[8d2c61ed892e27c5]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fcd61147333 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::ha3e42d46fe255c46
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/alloc/src/boxed.rs:1880:9
  12:     0x7fcd611596dd - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::h5530a261fac5a395
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/proc_macro/src/bridge/client.rs:335:21
  13:     0x7fcd713e7e56 - std::panicking::rust_panic_with_hook::h4565951773f90b0d
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/panicking.rs:702:17
  14:     0x7fcd713e7c57 - std::panicking::begin_panic_handler::{{closure}}::hc43ea5bc6ea479a7
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/panicking.rs:588:13
  15:     0x7fcd713e4e24 - std::sys_common::backtrace::__rust_end_short_backtrace::hce88d380b9b7207e
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/sys_common/backtrace.rs:138:18
  16:     0x7fcd713e7989 - rust_begin_unwind
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/panicking.rs:584:5
  17:     0x7fcd713ab933 - core::panicking::panic_fmt::h5088ed6a76740fc5
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/core/src/panicking.rs:142:14
  18:     0x7fcd7143be01 - core::panicking::panic_display::h1943abbc831ba687
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/core/src/panicking.rs:72:5
  19:     0x7fcd7143bdab - core::panicking::panic_str::h515e7e9b1ccc828a
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/core/src/panicking.rs:56:5
  20:     0x7fcd713ab7a6 - core::option::expect_failed::h940cf1bbf7d964ff
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/core/src/option.rs:1855:5
  21:     0x55a30525b349 - rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::resolve_associated_trait_item
  22:     0x55a305259aee - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector>::resolve_associated_item
  23:     0x55a305256cd5 - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector>::resolve
  24:     0x55a30525cc59 - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[1fc6f13c0da15d8c]::visit::DocVisitor>::visit_item
  25:     0x55a30526ddaa - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[1fc6f13c0da15d8c]::visit::DocVisitor>::visit_inner_recur
  26:     0x55a3052603d8 - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[1fc6f13c0da15d8c]::visit::DocVisitor>::visit_item
  27:     0x55a30526dd2a - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[1fc6f13c0da15d8c]::visit::DocVisitor>::visit_inner_recur
  28:     0x55a3052603bd - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[1fc6f13c0da15d8c]::visit::DocVisitor>::visit_item
  29:     0x55a30526dd2a - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[1fc6f13c0da15d8c]::visit::DocVisitor>::visit_inner_recur
  30:     0x55a3052603bd - <rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[1fc6f13c0da15d8c]::visit::DocVisitor>::visit_item
  31:     0x55a30525528c - rustdoc[1fc6f13c0da15d8c]::passes::collect_intra_doc_links::collect_intra_doc_links
  32:     0x55a305303e27 - rustdoc[1fc6f13c0da15d8c]::main_options::{closure#0}::{closure#0}::{closure#1}
  33:     0x55a3052a3649 - <rustc_interface[ad68b8c89b0ab142]::passes::QueryContext>::enter::<rustdoc[1fc6f13c0da15d8c]::main_options::{closure#0}::{closure#0}::{closure#1}, core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>>
  34:     0x55a3051f2979 - <rustc_interface[ad68b8c89b0ab142]::interface::Compiler>::enter::<rustdoc[1fc6f13c0da15d8c]::main_options::{closure#0}::{closure#0}, core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>>
  35:     0x55a3053882da - rustc_span[58998adc3a002fd7]::with_source_map::<core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>, rustc_interface[ad68b8c89b0ab142]::interface::create_compiler_and_run<core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>, rustdoc[1fc6f13c0da15d8c]::main_options::{closure#0}>::{closure#1}>
  36:     0x55a3051f5334 - rustc_interface[ad68b8c89b0ab142]::interface::create_compiler_and_run::<core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>, rustdoc[1fc6f13c0da15d8c]::main_options::{closure#0}>
  37:     0x55a3050f238a - rustdoc[1fc6f13c0da15d8c]::main_options
  38:     0x55a305389d1b - <scoped_tls[5587684970d3e6f5]::ScopedKey<rustc_span[58998adc3a002fd7]::SessionGlobals>>::set::<rustdoc[1fc6f13c0da15d8c]::main_args::{closure#0}, core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>>
  39:     0x55a30521d31f - std[965189dd79571a90]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ad68b8c89b0ab142]::util::run_in_thread_pool_with_globals<rustdoc[1fc6f13c0da15d8c]::main_args::{closure#0}, core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>>::{closure#0}, core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>>
  40:     0x55a3052c5aa9 - <<std[965189dd79571a90]::thread::Builder>::spawn_unchecked_<rustc_interface[ad68b8c89b0ab142]::util::run_in_thread_pool_with_globals<rustdoc[1fc6f13c0da15d8c]::main_args::{closure#0}, core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>>::{closure#0}, core[c15249dfec5bc62b]::result::Result<(), rustc_errors[b80d242712464baa]::ErrorGuaranteed>>::{closure#1} as core[c15249dfec5bc62b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7fcd713f2033 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h051b06cc552f7ca2
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/alloc/src/boxed.rs:1866:9
  42:     0x7fcd713f2033 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0ed7e89ffdc39ab5
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/alloc/src/boxed.rs:1866:9
  43:     0x7fcd713f2033 - std::sys::unix::thread::Thread::new::thread_start::hf01169ad6dd2310f
                               at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/sys/unix/thread.rs:108:17
  44:     0x7fcd7130a609 - start_thread
                               at /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
  45:     0x7fcd710b3163 - clone
  46:                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 (e7575f967 2022-04-14) running on x86_64-unknown-linux-gnu

note: compiler flags: --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 document `fltk`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2018 --crate-type lib --crate-name fltk fltk/src/lib.rs -o /tmp/fltk-rs/target/doc --cfg 'feature="default"' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=554e9c97422d16fb -L dependency=/tmp/fltk-rs/target/debug/deps --extern bitflags=/tmp/fltk-rs/target/debug/deps/libbitflags-f75283d3dcd3daad.rmeta --extern crossbeam_channel=/tmp/fltk-rs/target/debug/deps/libcrossbeam_channel-953c0c9c26457b2e.rmeta --extern fltk_sys=/tmp/fltk-rs/target/debug/deps/libfltk_sys-29c8541252091319.rmeta --extern paste=/tmp/fltk-rs/target/debug/deps/libpaste-85067c7f435fa569.so --extern ttf_parser=/tmp/fltk-rs/target/debug/deps/libttf_parser-d364752abb3e84e9.rmeta --crate-version 1.3.5` (exit status: 101)
@64kramsystem 64kramsystem 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 15, 2022
@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 18, 2022
@GuillaumeGomez
Copy link
Member

I'll take a look in the next days. Seems like it's an intra-doc link bug.

@GuillaumeGomez
Copy link
Member

Here is a code which reproduces the error:

pub mod app {
    pub struct S;

    impl S {
        /**
          Doc comment hello! [`Foo::by_name`](`crate::enums::Foo::by_name`).
        */
        pub fn whatever(&self) {}
    }
}

pub mod enums {
    pub enum Foo {
        Bar,
    }

    impl Foo {
        pub fn by_name(&self) {}
    }
}

@GuillaumeGomez
Copy link
Member

Surprisingly enough, /// doc comments don't reproduce the bug. This is highly surprising.

@GuillaumeGomez
Copy link
Member

Figured the problem: the doc block hasn't been cleaned yet in the early intra doc links pass. Meaning that it interprets the link as a code block (because of the indent) and therefore doesn't load the associated module.

@64kramsystem
Copy link
Author

Thanks for your work 🤩

workingjubilee pushed a commit to tcdi/postgrestd that referenced this issue Sep 15, 2022
rustdoc: Optimize and refactor doc link resolution

One more subset of rust-lang/rust#94857 that should bring perf improvements rather than regressions + a couple more optimizations on top of it.
It's better to read individual commits and their descriptions to understand the changes.
The `may_have_doc_links` optimization is not *very* useful here, but it's much more important for rust-lang/rust#94857.

Closes rust-lang/rust#96079
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
2 participants