Repository: rust
Issue: rustc_resolve: entered unreachable code in resolve_rustdoc_path
Labels: T-rustdoc,A-resolve,I-ICE,T-compiler,C-bug

### Code

"all of rustdoc, plus broken changes from #95450"

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`: rustc 1.62.0 (23a96e02d 2022-04-13) 

@rustbot label +T-rustdoc +A-resolve

### Error output

See the logs for https://github.com/rust-lang-ci/rust/runs/6005865530?check_suite_focus=true.

@petrochenkov this may not be worth investigating until I find a way to reproduce locally - just tagging you in case it's a simple fix.

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_resolve/src/lib.rs:1834:67
stack backtrace:
   0:     0x7f919bf11b72 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h40f8f3daa23f431e
   1:     0x7f919bf774a8 - core::fmt::write::h42d747535ccbaf5b
   2:     0x7f919bf02031 - std::io::Write::write_fmt::h495dbdc99589b77c
   3:     0x7f919bf14ea6 - std::panicking::default_hook::{{closure}}::h1f2cfb3a6707d9fe
   4:     0x7f919bf14aa5 - std::panicking::default_hook::h07bf01758e423d7c
   5:     0x7f919d0828fa - rustc_driver[9c3f2120bbf7371d]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:     0x7f918f29eb09 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hff3a3945c56c0b18
   7:     0x7f918f2ca3fb - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::hd8f4bb99054a635a
   8:     0x7f919bf157cd - std::panicking::rust_panic_with_hook::h85a296a572b16b0f
   9:     0x7f919bf15619 - std::panicking::begin_panic_handler::{{closure}}::h1b6f091ffeaf8dfa
  10:     0x7f919bf12114 - std::sys_common::backtrace::__rust_end_short_backtrace::h6654ca9f5c52ca6c
  11:     0x7f919bf15349 - rust_begin_unwind
  12:     0x7f919bec80e3 - core::panicking::panic_fmt::h7e15babac27fb630
  13:     0x7f919bec7fad - core::panicking::panic::h59ba1f41023369f0
  14:     0x7f91a144590b - <rustc_resolve[5e2eeef38d5b363f]::Resolver>::resolve_rustdoc_path
  15:     0x55d80d768ac0 - <rustdoc[234ebe4e4ad05f8c]::passes::collect_intra_doc_links::early::EarlyDocLinkResolver>::load_links_in_attrs
  16:     0x55d80d769144 - <rustdoc[234ebe4e4ad05f8c]::passes::collect_intra_doc_links::early::EarlyDocLinkResolver as rustc_ast[70b27e4311c19868]::visit::Visitor>::visit_item
  17:     0x55d80d7776fa - rustc_ast[70b27e4311c19868]::visit::walk_item::<rustdoc[234ebe4e4ad05f8c]::passes::collect_intra_doc_links::early::EarlyDocLinkResolver>
  18:     0x55d80d76918e - <rustdoc[234ebe4e4ad05f8c]::passes::collect_intra_doc_links::early::EarlyDocLinkResolver as rustc_ast[70b27e4311c19868]::visit::Visitor>::visit_item
  19:     0x55d80d7776fa - rustc_ast[70b27e4311c19868]::visit::walk_item::<rustdoc[234ebe4e4ad05f8c]::passes::collect_intra_doc_links::early::EarlyDocLinkResolver>
  20:     0x55d80d76918e - <rustdoc[234ebe4e4ad05f8c]::passes::collect_intra_doc_links::early::EarlyDocLinkResolver as rustc_ast[70b27e4311c19868]::visit::Visitor>::visit_item
  21:     0x55d80d70d72a - <rustc_interface[4431ea57bd42aced]::passes::boxed_resolver::BoxedResolver>::access::<rustdoc[234ebe4e4ad05f8c]::main_options::{closure#0}::{closure#0}::{closure#0}, rustdoc[234ebe4e4ad05f8c]::core::ResolverCaches>
  22:     0x55d80d5fc001 - <rustc_interface[4431ea57bd42aced]::interface::Compiler>::enter::<rustdoc[234ebe4e4ad05f8c]::main_options::{closure#0}::{closure#0}, core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>>
  23:     0x55d80d412296 - rustc_span[c84b1e53812dd887]::with_source_map::<core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>, rustc_interface[4431ea57bd42aced]::interface::create_compiler_and_run<core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>, rustdoc[234ebe4e4ad05f8c]::main_options::{closure#0}>::{closure#1}>
  24:     0x55d80d5ff063 - rustc_interface[4431ea57bd42aced]::interface::create_compiler_and_run::<core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>, rustdoc[234ebe4e4ad05f8c]::main_options::{closure#0}>
  25:     0x55d80d44b7da - rustdoc[234ebe4e4ad05f8c]::main_options
  26:     0x55d80d7af2db - <scoped_tls[9d249f0f2ce07b71]::ScopedKey<rustc_span[c84b1e53812dd887]::SessionGlobals>>::set::<rustdoc[234ebe4e4ad05f8c]::main_args::{closure#0}, core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>>
  27:     0x55d80d64eb2f - std[801cb7f74ea44579]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4431ea57bd42aced]::util::run_in_thread_pool_with_globals<rustdoc[234ebe4e4ad05f8c]::main_args::{closure#0}, core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>>::{closure#0}, core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>>
  28:     0x55d80d6f7769 - <<std[801cb7f74ea44579]::thread::Builder>::spawn_unchecked_<rustc_interface[4431ea57bd42aced]::util::run_in_thread_pool_with_globals<rustdoc[234ebe4e4ad05f8c]::main_args::{closure#0}, core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>>::{closure#0}, core[734429170246c524]::result::Result<(), rustc_errors[65f611344d5dc886]::ErrorGuaranteed>>::{closure#1} as core[734429170246c524]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7f919bf21f83 - std::sys::unix::thread::Thread::new::thread_start::hadd5bbf9df9317ed
  30:     0x7f919be3f609 - start_thread
  31:     0x7f919bbf8163 - clone
  32:                0x0 - <unknown>
```

</p>
</details>