Skip to content

rustdoc primitive re-export #67646

Closed
@Mark-Simulacrum

Description

@Mark-Simulacrum

When re-exporting a primitive type, rustdoc ICEs. This was found when creating #67645.

Rustdoc also fails to link the re-export to the primitive docs.

Reproduction:

// b.rs
pub mod p {
    pub use a::bar::*;
}

// a.rs
pub mod bar {
    pub use bool;
}

commands:

rustc --emit metadata a.rs --crate-type lib --edition 2018
rustdoc ./b.rs --extern a=./liba.rmeta --edition=2018

Backtrace:

error: internal compiler error: src/librustc/hir/def.rs:372: attempted .def_id() on invalid res: PrimTy(Bool)

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:891:9
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
             at /home/mark/Build/rust/src/libstd/panicking.rs:401
   7: rustc_errors::HandlerInner::bug
             at src/librustc_errors/lib.rs:891
   8: rustc_errors::Handler::bug
             at src/librustc_errors/lib.rs:651
   9: rustc::util::bug::opt_span_bug_fmt::{{closure}}
             at src/librustc/util/bug.rs:36
  10: rustc::ty::context::tls::with_opt::{{closure}}
             at src/librustc/ty/context.rs:1875
  11: rustc::ty::context::tls::with_context_opt
             at src/librustc/ty/context.rs:1827
  12: rustc::ty::context::tls::with_opt
             at src/librustc/ty/context.rs:1875
  13: rustc::util::bug::opt_span_bug_fmt
             at src/librustc/util/bug.rs:32
  14: rustc::util::bug::bug_fmt
             at src/librustc/util/bug.rs:12
  15: rustc::hir::def::Res<Id>::def_id::{{closure}}
  16: rustdoc::clean::inline::build_module::fill_in
  17: <rustdoc::doctree::Import as rustdoc::clean::Clean<alloc::vec::Vec<rustdoc::clean::types::Item>>>::clean
  18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::spec_extend
  19: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean
  20: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean
  21: rustdoc::clean::utils::krate
  22: rustc_rayon_core::tlv::with
  23: rustc::ty::context::tls::enter_global
  24: rustc_interface::interface::run_compiler_in_existing_thread_pool

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions