Skip to content

Commit

Permalink
Rollup merge of #98195 - GuillaumeGomez:rustdoc-json-primitive, r=not…
Browse files Browse the repository at this point in the history
…riddle

Fix rustdoc json primitive handling

Fixes #98006.

cc `@matthiaskrgr`
  • Loading branch information
JohnTitor committed Jun 18, 2022
2 parents d9559f4 + 7cdf126 commit 4557ff7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustdoc/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {

types::ItemEnum::Method(_)
| types::ItemEnum::AssocConst { .. }
| types::ItemEnum::AssocType { .. } => true,
| types::ItemEnum::AssocType { .. }
| types::ItemEnum::PrimitiveType(_) => true,
types::ItemEnum::Module(_)
| types::ItemEnum::ExternCrate { .. }
| types::ItemEnum::Import(_)
Expand All @@ -216,8 +217,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
| types::ItemEnum::Static(_)
| types::ItemEnum::ForeignType
| types::ItemEnum::Macro(_)
| types::ItemEnum::ProcMacro(_)
| types::ItemEnum::PrimitiveType(_) => false,
| types::ItemEnum::ProcMacro(_) => false,
};
let removed = self
.index
Expand Down
17 changes: 17 additions & 0 deletions src/test/rustdoc-json/primitive_overloading.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// compile-flags: --document-private-items

// Regression test for <https://github.com/rust-lang/rust/issues/98006>.

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

#![no_core]

// @has primitive_overloading.json
// @has - "$.index[*][?(@.name=='usize')]"
// @has - "$.index[*][?(@.name=='prim')]"

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

0 comments on commit 4557ff7

Please sign in to comment.