Skip to content

Commit 4557ff7

Browse files
authored
Rollup merge of #98195 - GuillaumeGomez:rustdoc-json-primitive, r=notriddle
Fix rustdoc json primitive handling Fixes #98006. cc `@matthiaskrgr`
2 parents d9559f4 + 7cdf126 commit 4557ff7

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/librustdoc/json/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
201201

202202
types::ItemEnum::Method(_)
203203
| types::ItemEnum::AssocConst { .. }
204-
| types::ItemEnum::AssocType { .. } => true,
204+
| types::ItemEnum::AssocType { .. }
205+
| types::ItemEnum::PrimitiveType(_) => true,
205206
types::ItemEnum::Module(_)
206207
| types::ItemEnum::ExternCrate { .. }
207208
| types::ItemEnum::Import(_)
@@ -216,8 +217,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
216217
| types::ItemEnum::Static(_)
217218
| types::ItemEnum::ForeignType
218219
| types::ItemEnum::Macro(_)
219-
| types::ItemEnum::ProcMacro(_)
220-
| types::ItemEnum::PrimitiveType(_) => false,
220+
| types::ItemEnum::ProcMacro(_) => false,
221221
};
222222
let removed = self
223223
.index
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// compile-flags: --document-private-items
2+
3+
// Regression test for <https://github.com/rust-lang/rust/issues/98006>.
4+
5+
#![feature(rustdoc_internals)]
6+
#![feature(no_core)]
7+
8+
#![no_core]
9+
10+
// @has primitive_overloading.json
11+
// @has - "$.index[*][?(@.name=='usize')]"
12+
// @has - "$.index[*][?(@.name=='prim')]"
13+
14+
#[doc(primitive = "usize")]
15+
/// This is the built-in type `usize`.
16+
mod prim {
17+
}

0 commit comments

Comments
 (0)