Skip to content

Commit 24c751b

Browse files
committed
Rustdoc-Json: Add test for extern_types
1 parent 393792d commit 24c751b

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/test/rustdoc-json/type/extern.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(extern_types)]
2+
3+
extern {
4+
/// No inner information
5+
pub type Foo;
6+
}
7+
8+
// @is "$.index[*][?(@.docs=='No inner information')].name" '"Foo"'
9+
// @is "$.index[*][?(@.docs=='No inner information')].kind" '"foreign_type"'
10+
// @!has "$.index[*][?(@.docs=='No inner information')].inner"

src/tools/jsondoclint/src/item_kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ impl Kind {
5252
Macro => true,
5353
ProcMacro => true,
5454
Primitive => true,
55+
ForeignType => true,
5556

5657
// FIXME(adotinthevoid): I'm not sure if these are corrent
57-
ForeignType => false,
5858
Keyword => false,
5959
OpaqueTy => false,
6060
ProcAttribute => false,

src/tools/jsondoclint/src/validator.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a> Validator<'a> {
6868
ItemEnum::OpaqueTy(x) => self.check_opaque_ty(x),
6969
ItemEnum::Constant(x) => self.check_constant(x),
7070
ItemEnum::Static(x) => self.check_static(x),
71-
ItemEnum::ForeignType => todo!(),
71+
ItemEnum::ForeignType => {} // nop
7272
ItemEnum::Macro(x) => self.check_macro(x),
7373
ItemEnum::ProcMacro(x) => self.check_proc_macro(x),
7474
ItemEnum::PrimitiveType(x) => self.check_primitive_type(x),
@@ -340,6 +340,13 @@ impl<'a> Validator<'a> {
340340
fp.generic_params.iter().for_each(|gpd| self.check_generic_param_def(gpd));
341341
}
342342

343+
// TODO: Remove
344+
fn add_id(&mut self, id: &'a Id) {
345+
if !self.seen_ids.contains(id) {
346+
self.todo.insert(id);
347+
}
348+
}
349+
343350
fn add_id_checked(&mut self, id: &'a Id, valid: fn(Kind) -> bool, expected: &str) {
344351
if let Some(kind) = self.kind_of(id) {
345352
if valid(kind) {

0 commit comments

Comments
 (0)