Skip to content

rustdoc primitive re-export #67646

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
Mark-Simulacrum opened this issue Dec 26, 2019 · 3 comments · Fixed by #68556
Closed

rustdoc primitive re-export #67646

Mark-Simulacrum opened this issue Dec 26, 2019 · 3 comments · Fixed by #68556
Assignees
Labels
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

@Mark-Simulacrum
Copy link
Member

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

@Mark-Simulacrum Mark-Simulacrum added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. labels Dec 26, 2019
@Mark-Simulacrum
Copy link
Member Author

I plan on investigating this issue tomorrow, as it is likely a blocker for #67637.

@Mark-Simulacrum
Copy link
Member Author

@rust-lang/rustdoc -- this is blocking #67637, and I was unable to come up with a simple patch to fix this. Is this a known-hard problem, or should I try to keep digging? master...Mark-Simulacrum:primitive-reexport contains my initial patch, but it fails tests (e.g., auto impls for primitives, among other problems).

@GuillaumeGomez
Copy link
Member

I'll try to take a look shortly. And no, never heard of it before you opened this issue. Don't hesitate to ping me if I forget.

# 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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
2 participants