Repository: rust
Issue: rustdoc warns "no item in scope" due to extra doc string
Labels: T-rustdoc,C-bug,A-intra-doc-links

This is a minimal example of the problem; in my actual case `foo` is a separate file, which made the error harder to spot:

```rust
//! My cool crate
//!
//! Hello world.

/// foo is a module
pub mod foo {
    //! Foo docs
    //!
    //! The main thing is [S].

    /// S is a thing.
    pub struct S;
}
```

Running `cargo doc` or `rustdoc src/lib.rs` gives:

```
 Documenting mycrate v0.1.0 (/home/osse/dev/rustdoctest)
warning: unresolved link to `S`
 --> src/lib.rs:9:28
  |
9 |     //! The main thing is [S].
  |                            ^ no item named `S` in scope
  |
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
  = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
```

Honestly I don't know what I expected to happen; in hindsight the doc comments don't make that much sense. But I think the error can be improved. This happened as I was starting to write docs for `foo` in my actual `foo.rs` and it took me a good while to first find the offending doc line and even consider that to be the problem.

What seems to happen is that the presence of `/// foo is a module` makes rustdoc resolve links in the docs inside `pub mod foo { }`  as if they were written outside. In the generated docs the headers "My cool crate" and "Foo docs" appear concatenated into one. Removing `/// foo is a module`  makes the error go away and the link in the generated docs works as expected.

I tried fixing it myself, but realized that it would take me a very long time, and besides I don't really know what an acceptable solution would be. My best suggestion is to make this an error and only allow either `/// blah mod foo;` _or_ `mod foo { //! blah }`

### Meta
This happens in both latest stable and nightly as well as in my own locally compiled `rustdoc`. 

There is no backtrace as rustdoc doesn't crash or error out but rather just prints a warning. Obviously this isn't an actual ICE. Changing the `format!`ting of the "no item named ..." error message into a `panic!` gives this backtrace:

<details><summary>backtrace</summary>

```
thread 'rustc' panicked at src/librustdoc/passes/collect_intra_doc_links.rs:1854:29:
no item named `S` in scope
stack backtrace:
   0:     0x7f1b2558b756 - std::backtrace_rs::backtrace::libunwind::trace::hbc2da4b61dd0c372
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f1b2558b756 - std::backtrace_rs::backtrace::trace_unsynchronized::h7ad8b35b7c8d688c
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1b2558b756 - std::sys_common::backtrace::_print_fmt::hc12cc0442874a4d6
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f1b2558b756 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4b9fcac3af912075
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1b255de080 - core::fmt::rt::Argument::fmt::h745f2073473e3ec1
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/core/src/fmt/rt.rs:142:9
   5:     0x7f1b255de080 - core::fmt::write::h8ddb66e46c6e9fcd
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f1b2557f40f - std::io::Write::write_fmt::h898cd1b0a004b140
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/io/mod.rs:1810:15
   7:     0x7f1b2558b534 - std::sys_common::backtrace::_print::hbe7ec509934faa29
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1b2558b534 - std::sys_common::backtrace::print::h87cf2b6cec3d6605
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1b2558e2c7 - std::panicking::default_hook::{{closure}}::hd6ecd78a32b3eeb4
  10:     0x7f1b2558e029 - std::panicking::default_hook::he3392b6c1f3dcaf7
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/panicking.rs:292:9
  11:     0x7f1b2835511c - std[deca0889ce82c4db]::panicking::update_hook::<alloc[c2a284bac12f97e4]::boxed::Box<rustc_driver_impl[f95eaa42ee435085]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f1b2558ea16 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2d534bf7bce6913d
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/alloc/src/boxed.rs:2029:9
  13:     0x7f1b2558ea16 - std::panicking::rust_panic_with_hook::h7d752117b85b83e1
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/panicking.rs:783:13
  14:     0x7f1b2558e762 - std::panicking::begin_panic_handler::{{closure}}::h7758fdcb252a4373
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/panicking.rs:657:13
  15:     0x7f1b2558bc56 - std::sys_common::backtrace::__rust_end_short_backtrace::h33318c74edd27a7a
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f1b2558e4c0 - rust_begin_unwind
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/panicking.rs:645:5
  17:     0x7f1b255da785 - core::panicking::panic_fmt::h049eb3a7f452cc88
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/core/src/panicking.rs:72:14
  18:     0x55bbe14e990f - rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::resolution_failure::{closure#0}
  19:     0x55bbe14e990f - rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::report_diagnostic::<alloc[c2a284bac12f97e4]::string::String, rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::resolution_failure::{closure#0}>::{closure#0}
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:1757:9
  20:     0x55bbe14e990f - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::report_diagnostic<alloc[c2a284bac12f97e4]::string::String, rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::resolution_failure::{closure#0}>::{closure#0} as core[cb10df156024dda0]::ops::function::FnOnce<(&mut rustc_errors[f8826f9bc6fe49c4]::diagnostic_builder::DiagnosticBuilder<()>,)>>::call_once::{shim:vtable#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/core/src/ops/function.rs:250:5
  21:     0x55bbe1475e92 - <alloc[c2a284bac12f97e4]::boxed::Box<dyn for<'a, 'b> core[cb10df156024dda0]::ops::function::FnOnce<(&'a mut rustc_errors[f8826f9bc6fe49c4]::diagnostic_builder::DiagnosticBuilder<'b, ()>,), Output = ()>> as core[cb10df156024dda0]::ops::function::FnOnce<(&mut rustc_errors[f8826f9bc6fe49c4]::diagnostic_builder::DiagnosticBuilder<()>,)>>::call_once
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/alloc/src/boxed.rs:2015:9
  22:     0x55bbe14e36e3 - rustc_middle[38fb98e9c6d777f4]::lint::struct_lint_level::struct_lint_level_impl::<alloc[c2a284bac12f97e4]::string::String>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_middle/src/lint.rs:404:9
  23:     0x55bbe14de59c - rustc_middle[38fb98e9c6d777f4]::lint::struct_lint_level::<alloc[c2a284bac12f97e4]::string::String, rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::report_diagnostic<alloc[c2a284bac12f97e4]::string::String, rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::resolution_failure::{closure#0}>::{closure#0}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_middle/src/lint.rs:408:5
  24:     0x55bbe12851f1 - <rustc_middle[38fb98e9c6d777f4]::ty::context::TyCtxt>::struct_span_lint_hir::<rustc_span[aa5b2f0b8a15275b]::span_encoding::Span, alloc[c2a284bac12f97e4]::string::String, rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::report_diagnostic<alloc[c2a284bac12f97e4]::string::String, rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::resolution_failure::{closure#0}>::{closure#0}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_middle/src/ty/context.rs:2081:9
  25:     0x55bbe1517b57 - rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::report_diagnostic::<alloc[c2a284bac12f97e4]::string::String, rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::resolution_failure::{closure#0}>
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:1706:5
  26:     0x55bbe1517b57 - rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::resolution_failure
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:1774:5
  27:     0x55bbe1516ca0 - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector>::resolve_with_disambiguator
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:1376:25
  28:     0x55bbe1516ca0 - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector>::resolve_with_disambiguator_cached
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:1252:30
  29:     0x55bbe151ebf0 - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector>::resolve_link
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:1032:35
  30:     0x55bbe151ebf0 - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector>::resolve_links
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:1001:28
  31:     0x55bbe151bdc0 - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[6563f7f7b44140c7]::visit::DocVisitor>::visit_item
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:838:9
  32:     0x55bbe151bdc0 - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[6563f7f7b44140c7]::visit::DocVisitor>::visit_mod::{closure#0}
                               at /home/osse/dev/rust/src/librustdoc/visit.rs:59:37
  33:     0x55bbe151bdc0 - <core[cb10df156024dda0]::slice::iter::Iter<rustdoc[6563f7f7b44140c7]::clean::types::Item> as core[cb10df156024dda0]::iter::traits::iterator::Iterator>::for_each::<<rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[6563f7f7b44140c7]::visit::DocVisitor>::visit_mod::{closure#0}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/core/src/slice/iter/macros.rs:254:21
  34:     0x55bbe151bdc0 - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[6563f7f7b44140c7]::visit::DocVisitor>::visit_mod
                               at /home/osse/dev/rust/src/librustdoc/visit.rs:59:9
  35:     0x55bbe151bdc0 - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[6563f7f7b44140c7]::visit::DocVisitor>::visit_inner_recur
                               at /home/osse/dev/rust/src/librustdoc/visit.rs:13:17
  36:     0x55bbe151032e - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[6563f7f7b44140c7]::visit::DocVisitor>::visit_item_recur
  37:     0x55bbe151032e - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[6563f7f7b44140c7]::visit::DocVisitor>::visit_item
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:839:9
  38:     0x55bbe151032e - <rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::LinkCollector as rustdoc[6563f7f7b44140c7]::visit::DocVisitor>::visit_crate
                               at /home/osse/dev/rust/src/librustdoc/visit.rs:63:9
  39:     0x55bbe151032e - rustdoc[6563f7f7b44140c7]::passes::collect_intra_doc_links::collect_intra_doc_links
                               at /home/osse/dev/rust/src/librustdoc/passes/collect_intra_doc_links.rs:49:5
  40:     0x55bbe123fade - rustdoc[6563f7f7b44140c7]::core::run_global_ctxt::{closure#8}
                               at /home/osse/dev/rust/src/librustdoc/core.rs:444:51
  41:     0x55bbe123fade - <rustc_data_structures[3e5f372105827e0f]::profiling::VerboseTimingGuard>::run::<rustdoc[6563f7f7b44140c7]::clean::types::Crate, rustdoc[6563f7f7b44140c7]::core::run_global_ctxt::{closure#8}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_data_structures/src/profiling.rs:752:9
  42:     0x55bbe123fade - <rustc_session[fc2904b91b44d305]::session::Session>::time::<rustdoc[6563f7f7b44140c7]::clean::types::Crate, rustdoc[6563f7f7b44140c7]::core::run_global_ctxt::{closure#8}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_session/src/utils.rs:12:9
  43:     0x55bbe123fade - rustdoc[6563f7f7b44140c7]::core::run_global_ctxt
                               at /home/osse/dev/rust/src/librustdoc/core.rs:444:21
  44:     0x55bbe123fade - rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#0}
                               at /home/osse/dev/rust/src/librustdoc/lib.rs:808:21
  45:     0x55bbe123fade - <rustc_data_structures[3e5f372105827e0f]::profiling::VerboseTimingGuard>::run::<(rustdoc[6563f7f7b44140c7]::clean::types::Crate, rustdoc[6563f7f7b44140c7]::config::RenderOptions, rustdoc[6563f7f7b44140c7]::formats::cache::Cache), rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#0}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_data_structures/src/profiling.rs:752:9
  46:     0x55bbe123fade - <rustc_session[fc2904b91b44d305]::session::Session>::time::<(rustdoc[6563f7f7b44140c7]::clean::types::Crate, rustdoc[6563f7f7b44140c7]::config::RenderOptions, rustdoc[6563f7f7b44140c7]::formats::cache::Cache), rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#0}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_session/src/utils.rs:12:9
  47:     0x55bbe12830cd - rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}
                               at /home/osse/dev/rust/src/librustdoc/lib.rs:807:55
  48:     0x55bbe12830cd - <rustc_middle[38fb98e9c6d777f4]::ty::context::GlobalCtxt>::enter::<rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_middle/src/ty/context.rs:666:37
  49:     0x55bbe12830cd - rustc_middle[38fb98e9c6d777f4]::ty::context::tls::enter_context::<<rustc_middle[38fb98e9c6d777f4]::ty::context::GlobalCtxt>::enter<rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_middle/src/ty/context/tls.rs:82:9
  50:     0x55bbe12830cd - <std[deca0889ce82c4db]::thread::local::LocalKey<core[cb10df156024dda0]::cell::Cell<*const ()>>>::try_with::<rustc_middle[38fb98e9c6d777f4]::ty::context::tls::enter_context<<rustc_middle[38fb98e9c6d777f4]::ty::context::GlobalCtxt>::enter<rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/thread/local.rs:270:16
  51:     0x55bbe12830cd - <std[deca0889ce82c4db]::thread::local::LocalKey<core[cb10df156024dda0]::cell::Cell<*const ()>>>::with::<rustc_middle[38fb98e9c6d777f4]::ty::context::tls::enter_context<<rustc_middle[38fb98e9c6d777f4]::ty::context::GlobalCtxt>::enter<rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/thread/local.rs:246:9
  52:     0x55bbe12830cd - rustc_middle[38fb98e9c6d777f4]::ty::context::tls::enter_context::<<rustc_middle[38fb98e9c6d777f4]::ty::context::GlobalCtxt>::enter<rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_middle/src/ty/context/tls.rs:79:9
  53:     0x55bbe12830cd - <rustc_middle[38fb98e9c6d777f4]::ty::context::GlobalCtxt>::enter::<rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_middle/src/ty/context.rs:666:9
  54:     0x55bbe139d45d - <rustc_interface[edcd441960a74143]::queries::QueryResult<&rustc_middle[38fb98e9c6d777f4]::ty::context::GlobalCtxt>>::enter::<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}::{closure#0}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_interface/src/queries.rs:71:9
  55:     0x55bbe139d45d - rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}
                               at /home/osse/dev/rust/src/librustdoc/lib.rs:806:13
  56:     0x55bbe139d45d - <rustc_interface[edcd441960a74143]::interface::Compiler>::enter::<rustdoc[6563f7f7b44140c7]::main_args::{closure#1}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_interface/src/queries.rs:314:19
  57:     0x55bbe125b961 - rustdoc[6563f7f7b44140c7]::main_args::{closure#1}
                               at /home/osse/dev/rust/src/librustdoc/lib.rs:800:9
  58:     0x55bbe125b961 - rustc_interface[edcd441960a74143]::interface::run_compiler::<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}::{closure#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_interface/src/interface.rs:421:21
  59:     0x55bbe125b961 - rustc_span[aa5b2f0b8a15275b]::set_source_map::<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}::{closure#0}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_span/src/lib.rs:1051:5
  60:     0x55bbe125b961 - rustc_interface[edcd441960a74143]::interface::run_compiler::<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_interface/src/interface.rs:415:13
  61:     0x55bbe123bc0a - rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals::<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_interface/src/util.rs:117:13
  62:     0x55bbe123bc0a - <scoped_tls[da3cca1f1419071d]::ScopedKey<rustc_span[aa5b2f0b8a15275b]::SessionGlobals>>::set::<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rust/deps/scoped-tls-1.0.1/src/lib.rs:137:9
  63:     0x55bbe123bc0a - rustc_span[aa5b2f0b8a15275b]::create_session_globals_then::<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_span/src/lib.rs:130:5
  64:     0x55bbe13684b0 - rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals::<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/compiler/rustc_interface/src/util.rs:79:38
  65:     0x55bbe13684b0 - std[deca0889ce82c4db]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/sys_common/backtrace.rs:155:18
  66:     0x55bbe1254f74 - <std[deca0889ce82c4db]::thread::Builder>::spawn_unchecked_::<rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#1}::{closure#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/thread/mod.rs:529:17
  67:     0x55bbe1254f74 - <core[cb10df156024dda0]::panic::unwind_safe::AssertUnwindSafe<<std[deca0889ce82c4db]::thread::Builder>::spawn_unchecked_<rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#1}::{closure#0}> as core[cb10df156024dda0]::ops::function::FnOnce<()>>::call_once
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/core/src/panic/unwind_safe.rs:272:9
  68:     0x55bbe1254f74 - std[deca0889ce82c4db]::panicking::try::do_call::<core[cb10df156024dda0]::panic::unwind_safe::AssertUnwindSafe<<std[deca0889ce82c4db]::thread::Builder>::spawn_unchecked_<rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#1}::{closure#0}>, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/panicking.rs:552:40
  69:     0x55bbe1254f74 - std[deca0889ce82c4db]::panicking::try::<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, core[cb10df156024dda0]::panic::unwind_safe::AssertUnwindSafe<<std[deca0889ce82c4db]::thread::Builder>::spawn_unchecked_<rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#1}::{closure#0}>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/panicking.rs:516:19
  70:     0x55bbe1464e73 - std[deca0889ce82c4db]::panic::catch_unwind::<core[cb10df156024dda0]::panic::unwind_safe::AssertUnwindSafe<<std[deca0889ce82c4db]::thread::Builder>::spawn_unchecked_<rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#1}::{closure#0}>, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/panic.rs:142:14
  71:     0x55bbe1464e73 - <std[deca0889ce82c4db]::thread::Builder>::spawn_unchecked_::<rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#1}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/thread/mod.rs:528:30
  72:     0x55bbe1464e73 - <<std[deca0889ce82c4db]::thread::Builder>::spawn_unchecked_<rustc_interface[edcd441960a74143]::util::run_in_thread_with_globals<rustc_interface[edcd441960a74143]::util::run_in_thread_pool_with_globals<rustc_interface[edcd441960a74143]::interface::run_compiler<core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>, rustdoc[6563f7f7b44140c7]::main_args::{closure#1}>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb10df156024dda0]::result::Result<(), rustc_span[aa5b2f0b8a15275b]::ErrorGuaranteed>>::{closure#1} as core[cb10df156024dda0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/core/src/ops/function.rs:250:5
  73:     0x7f1b25598945 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h44369edd0d96ca0d
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/alloc/src/boxed.rs:2015:9
  74:     0x7f1b25598945 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h71556d488885a523
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/alloc/src/boxed.rs:2015:9
  75:     0x7f1b25598945 - std::sys::unix::thread::Thread::new::thread_start::h46db652d65e1cf2a
                               at /rustc/3ee671095499d83ba18d510683fa2a784d7d2ad2/library/std/src/sys/unix/thread.rs:108:17
  76:     0x7f1b25097ada - start_thread
                               at ./nptl/pthread_create.c:444:8
  77:     0x7f1b2512847c - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
  78:                0x0 - <unknown>

error: 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-rustdoc&template=ice.md

note: please attach the file at `/home/osse/dev/rustdoctest/rustc-ice-2024-01-14T13_57_50-57923.txt` to your bug report

query stack during panic:
end of query stack
```

</details>