Skip to content

rustdoc ICE: entered unreachable code when referring to an item with a path that starts with :: #95712

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
lopopolo opened this issue Apr 6, 2022 · 4 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

@lopopolo
Copy link
Contributor

lopopolo commented Apr 6, 2022

Code

https://github.com/artichoke/artichoke/runs/5843879077?check_suite_focus=true

https://github.com/artichoke/artichoke/tree/8e2def19b23f430f9356e16a885d0609a9cc18d4/spinoso-array

Minimum reproduction:

//! `SmallArray` is based on [`SmallVec`].
//!
//! [`SmallVec`]: ::smallvec::SmallVec

extern crate smallvec;

I used the :: item prefix because in real code, there is a smallvec module that shadows the smallvec crate:

extern crate smallvec;

pub mod inner {
    //! [`SmallArray`](smallvec::SmallArray) is based on [`SmallVec`].
    //!
    //! [`SmallVec`]: ::smallvec::SmallVec

    mod smallvec {
        pub struct SmallArray;
    }
}

Meta

rustc --version --verbose:

rust version 1.62.0-nightly (306ba8357 2022-04-05)

Error output

Documenting spinoso-array v0.8.0 (/home/runner/work/artichoke/artichoke/spinoso-array)
thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_resolve/src/lib.rs:3302:67
stack backtrace:
   0: rust_begin_unwind
             at /rustc/306ba8357fb36212b7d30efb9eb9e41659ac1445/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/306ba8357fb36212b7d30efb9eb9e41659ac1445/library/core/src/panicking.rs:143:14
   2: core::panicking::panic
             at /rustc/306ba8357fb36212b7d30efb9eb9e41659ac1445/library/core/src/panicking.rs:48:5
   3: <rustc_resolve::Resolver>::resolve_rustdoc_path
   4: <rustdoc::core::DocContext>::enter_resolver::<<rustdoc::passes::collect_intra_doc_links::LinkCollector>::resolve_path::{closure#0}, core::option::Option<rustc_hir::def::Res<rustc_ast::node_id::NodeId>>>
   5: <rustdoc::passes::collect_intra_doc_links::LinkCollector>::resolve_path
   6: <rustdoc::passes::collect_intra_doc_links::LinkCollector>::resolve
   7: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_item
   8: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_inner_recur
   9: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::visit::DocVisitor>::visit_item
  10: rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links
  11: <rustc_session::session::Session>::time::<(rustdoc::clean::types::Crate, rustdoc::config::RenderOptions, rustdoc::formats::cache::Cache), rustdoc::main_options::{closure#0}::{closure#0}::{closure#1}::{closure#0}>
  12: <rustc_interface::passes::QueryContext>::enter::<rustdoc::main_options::{closure#0}::{closure#0}::{closure#1}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  13: <rustc_interface::interface::Compiler>::enter::<rustdoc::main_options::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  14: 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}>
  15: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustdoc::main_options::{closure#0}>
  16: rustdoc::main_options
  17: <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.

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 (306ba8357 [202](https://github.com/artichoke/artichoke/runs/5843879077?check_suite_focus=true#step:5:202)2-04-05) 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 `spinoso-array`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name spinoso_array spinoso-array/src/lib.rs -o /home/runner/work/artichoke/artichoke/target/doc --cfg 'feature="default"' --cfg 'feature="small-array"' --cfg 'feature="smallvec"' --cfg 'feature="tiny-array"' --cfg 'feature="tinyvec"' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=22abae37387d1eae -L dependency=/home/runner/work/artichoke/artichoke/target/debug/deps --extern raw_parts=/home/runner/work/artichoke/artichoke/target/debug/deps/libraw_parts-8048735f980e92ee.rmeta --extern smallvec=/home/runner/work/artichoke/artichoke/target/debug/deps/libsmallvec-61e548ea0cf3be6d.rmeta --extern tinyvec=/home/runner/work/artichoke/artichoke/target/debug/deps/libtinyvec-8a75832bb51562ff.rmeta -D warnings -D 'rustdoc::broken_intra_doc_links' --cfg docsrs --crate-version 0.8.0` (exit status: 101)
@lopopolo lopopolo 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 6, 2022
@lopopolo
Copy link
Contributor Author

lopopolo commented Apr 6, 2022

Is #95681 related?

@lopopolo lopopolo changed the title rustdoc ICE: entered unreachable code rustdoc ICE: entered unreachable code when referring to an item with a path that starts with :: Apr 6, 2022
@petrochenkov
Copy link
Contributor

@lopopolo
#95681 was supposed to fix this issue (previously reported in #95337 (comment)), not to introduce it.

@petrochenkov
Copy link
Contributor

I've just checked, this is fixed on master.

@lopopolo
Copy link
Contributor Author

lopopolo commented Apr 6, 2022

Thank you! I'll bump my CI builds once the new nightly gets cut.

# for free to join this conversation on GitHub. Already have an account? # 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

2 participants