Skip to content

ICE: rustdoc json when #[doc(primitive)] mod name is same as primitive name. #102363

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(no_core)]
#![no_core]

#[doc(primitive = "usize")]
/// This is the built-in type `usize`.
mod usize {
}

This is a regression that started happening between
rustdoc 1.66.0-nightly (8b705839c 2022-09-26) (no ice) and
rustdoc 1.66.0-nightly (57ee5cf5a 2022-09-27) (ice)

rustdoc --document-private-items -Zunstable-options --output-format=json

Backtrace

warning: `doc(primitive)` should never have been stable
 --> 98006.rs:6:7
  |
6 | #[doc(primitive = "usize")]
  |       ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(invalid_doc_attributes)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Item { id: Id("0:1:1516"), crate_id: 0, name: Some("usize"), span: Some(Span { filename: "98006.rs", begin: (8, 0), end: (8, 9) }), visibility: Crate, docs: Some("This is the built-in type `usize`."), links: {}, attrs: ["#[doc(primitive = \"usize\")]"], deprecation: None, inner: Module(Module { is_crate: false, items: [], is_stripped: false }) }`,
 right: `Item { id: Id("0:1:1516"), crate_id: 0, name: Some("usize"), span: Some(Span { filename: "98006.rs", begin: (8, 0), end: (9, 1) }), visibility: Public, docs: Some("This is the built-in type `usize`."), links: {}, attrs: ["#[doc(primitive = \"usize\")]"], deprecation: None, inner: Primitive(Primitive { name: "usize", impls: [] }) }`', src/librustdoc/json/mod.rs:258:21
stack backtrace:
   0:     0x7f8b1b682170 - std::backtrace_rs::backtrace::libunwind::trace::h18072076057b94d0
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f8b1b682170 - std::backtrace_rs::backtrace::trace_unsynchronized::h532d7bcf1e66d957
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f8b1b682170 - std::sys_common::backtrace::_print_fmt::h97186aed02d3795a
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f8b1b682170 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h112f6af2ce1fe574
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f8b1b6dce2e - core::fmt::write::h3881197b972a8ed1
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f8b1b672cb5 - std::io::Write::write_fmt::h1b373ce231ecbbd3
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/io/mod.rs:1679:15
   6:     0x7f8b1b684ef3 - std::sys_common::backtrace::_print::hc775c17a0b8c6b1b
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f8b1b684ef3 - std::sys_common::backtrace::print::ha88e092611b4deb6
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f8b1b684ef3 - std::panicking::default_hook::{{closure}}::h5b92fe4806ec2836
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/panicking.rs:267:22
   9:     0x7f8b1b684bdf - std::panicking::default_hook::h75816c7fe1dfa8fc
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/panicking.rs:286:9
  10:     0x7f8b1dec10e1 - rustc_driver[c6fdf2c45090383f]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f8b1b68572b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hcb24b686ebdf651a
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/alloc/src/boxed.rs:1952:9
  12:     0x7f8b1b68572b - std::panicking::rust_panic_with_hook::h9ff72342096b4ba9
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/panicking.rs:673:13
  13:     0x7f8b1b685587 - std::panicking::begin_panic_handler::{{closure}}::h44b52a3dcbc6194f
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/panicking.rs:560:13
  14:     0x7f8b1b68261c - std::sys_common::backtrace::__rust_end_short_backtrace::h3f28777c5c6b6c07
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/sys_common/backtrace.rs:138:18
  15:     0x7f8b1b6852a2 - rust_begin_unwind
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/panicking.rs:556:5
  16:     0x7f8b1b6d9a03 - core::panicking::panic_fmt::h78ff0847a851546f
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/core/src/panicking.rs:142:14
  17:     0x7f8b1b6d9c0b - core::panicking::assert_failed_inner::h5c9e7ac3b8a65a4e
  18:     0x561a4a38dcab - core[7bc7496ae1e2fee9]::panicking::assert_failed::<rustdoc_json_types[5cc9bbe84b676943]::Item, rustdoc_json_types[5cc9bbe84b676943]::Item>
  19:     0x561a4a55d8e5 - <rustdoc[e0c88defa146e256]::json::JsonRenderer as rustdoc[e0c88defa146e256]::formats::renderer::FormatRenderer>::item
  20:     0x561a4a5586a9 - <rustdoc[e0c88defa146e256]::json::JsonRenderer as rustdoc[e0c88defa146e256]::formats::renderer::FormatRenderer>::item
  21:     0x561a4a54d3bc - rustdoc[e0c88defa146e256]::formats::renderer::run_format::<rustdoc[e0c88defa146e256]::json::JsonRenderer>
  22:     0x561a4a277962 - rustdoc[e0c88defa146e256]::run_renderer::<rustdoc[e0c88defa146e256]::json::JsonRenderer>
  23:     0x561a4a519c58 - <rustc_session[25cfbabaae5db07f]::session::Session>::time::<core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>, rustdoc[e0c88defa146e256]::main_options::{closure#0}::{closure#0}::{closure#1}::{closure#2}>
  24:     0x561a4a46d588 - <rustc_interface[30c3b065dc69ec4b]::passes::QueryContext>::enter::<rustdoc[e0c88defa146e256]::main_options::{closure#0}::{closure#0}::{closure#1}, core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>>
  25:     0x561a4a3bc95b - <rustc_interface[30c3b065dc69ec4b]::interface::Compiler>::enter::<rustdoc[e0c88defa146e256]::main_options::{closure#0}::{closure#0}, core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>>
  26:     0x561a4a5911b0 - rustc_span[7cf632b9cf8d883f]::with_source_map::<core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>, rustc_interface[30c3b065dc69ec4b]::interface::create_compiler_and_run<core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>, rustdoc[e0c88defa146e256]::main_options::{closure#0}>::{closure#1}>
  27:     0x561a4a3c0d8e - rustc_interface[30c3b065dc69ec4b]::interface::create_compiler_and_run::<core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>, rustdoc[e0c88defa146e256]::main_options::{closure#0}>
  28:     0x561a4a279680 - rustdoc[e0c88defa146e256]::main_options
  29:     0x561a4a3be0bb - <scoped_tls[a7b6c99e8efb4b77]::ScopedKey<rustc_span[7cf632b9cf8d883f]::SessionGlobals>>::set::<rustdoc[e0c88defa146e256]::main_args::{closure#0}, core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>>
  30:     0x561a4a52fef0 - std[3920356c99757f55]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[30c3b065dc69ec4b]::util::run_in_thread_pool_with_globals<rustdoc[e0c88defa146e256]::main_args::{closure#0}, core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>>::{closure#0}, core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>>
  31:     0x561a4a3f065c - <<std[3920356c99757f55]::thread::Builder>::spawn_unchecked_<rustc_interface[30c3b065dc69ec4b]::util::run_in_thread_pool_with_globals<rustdoc[e0c88defa146e256]::main_args::{closure#0}, core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>>::{closure#0}, core[7bc7496ae1e2fee9]::result::Result<(), rustc_errors[3785ec4f24cf7dcd]::ErrorGuaranteed>>::{closure#1} as core[7bc7496ae1e2fee9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7f8b1b68f393 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd5fc23daeb019c95
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/alloc/src/boxed.rs:1938:9
  33:     0x7f8b1b68f393 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3edde1a879c58522
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/alloc/src/boxed.rs:1938:9
  34:     0x7f8b1b68f393 - std::sys::unix::thread::Thread::new::thread_start::h7d0849b25413c998
                               at /rustc/57ee5cf5a93923dae9c98bffb11545fc3a31368d/library/std/src/sys/unix/thread.rs:108:17
  35:     0x7f8b1b3c778d - <unknown>
  36:     0x7f8b1b4488e4 - clone
  37:                0x0 - <unknown>

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.66.0-nightly (57ee5cf5a 2022-09-27) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options

query stack during panic:
end of query stack
warning: 1 warning emitted

Metadata

Metadata

Assignees

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendC-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions