diff options
| author | Nixon Enraght-Moony <nixon.emoony@gmail.com> | 2022-09-14 15:08:56 +0100 |
|---|---|---|
| committer | Nixon Enraght-Moony <nixon.emoony@gmail.com> | 2022-09-14 16:14:15 +0100 |
| commit | 24c751b2bad4a3cb6020462d3769f735762ef5b3 (patch) | |
| tree | 2ab4ee4aeb86b8c87140398bd68fda91ecda50dc | |
| parent | 393792da8d8a931643baf855369df0a009acdb19 (diff) | |
| download | rust-24c751b2bad4a3cb6020462d3769f735762ef5b3.tar.gz rust-24c751b2bad4a3cb6020462d3769f735762ef5b3.zip | |
Rustdoc-Json: Add test for extern_types
| -rw-r--r-- | src/test/rustdoc-json/type/extern.rs | 10 | ||||
| -rw-r--r-- | src/tools/jsondoclint/src/item_kind.rs | 2 | ||||
| -rw-r--r-- | src/tools/jsondoclint/src/validator.rs | 9 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/test/rustdoc-json/type/extern.rs b/src/test/rustdoc-json/type/extern.rs new file mode 100644 index 00000000000..d287d5ebec5 --- /dev/null +++ b/src/test/rustdoc-json/type/extern.rs @@ -0,0 +1,10 @@ +#![feature(extern_types)] + +extern { + /// No inner information + pub type Foo; +} + +// @is "$.index[*][?(@.docs=='No inner information')].name" '"Foo"' +// @is "$.index[*][?(@.docs=='No inner information')].kind" '"foreign_type"' +// @!has "$.index[*][?(@.docs=='No inner information')].inner" diff --git a/src/tools/jsondoclint/src/item_kind.rs b/src/tools/jsondoclint/src/item_kind.rs index b3e88a90813..65d7143d133 100644 --- a/src/tools/jsondoclint/src/item_kind.rs +++ b/src/tools/jsondoclint/src/item_kind.rs @@ -52,9 +52,9 @@ impl Kind { Macro => true, ProcMacro => true, Primitive => true, + ForeignType => true, // FIXME(adotinthevoid): I'm not sure if these are corrent - ForeignType => false, Keyword => false, OpaqueTy => false, ProcAttribute => false, diff --git a/src/tools/jsondoclint/src/validator.rs b/src/tools/jsondoclint/src/validator.rs index efe2c165b6c..d7bf6fe9e3c 100644 --- a/src/tools/jsondoclint/src/validator.rs +++ b/src/tools/jsondoclint/src/validator.rs @@ -68,7 +68,7 @@ impl<'a> Validator<'a> { ItemEnum::OpaqueTy(x) => self.check_opaque_ty(x), ItemEnum::Constant(x) => self.check_constant(x), ItemEnum::Static(x) => self.check_static(x), - ItemEnum::ForeignType => todo!(), + ItemEnum::ForeignType => {} // nop ItemEnum::Macro(x) => self.check_macro(x), ItemEnum::ProcMacro(x) => self.check_proc_macro(x), ItemEnum::PrimitiveType(x) => self.check_primitive_type(x), @@ -340,6 +340,13 @@ impl<'a> Validator<'a> { fp.generic_params.iter().for_each(|gpd| self.check_generic_param_def(gpd)); } + // TODO: Remove + fn add_id(&mut self, id: &'a Id) { + if !self.seen_ids.contains(id) { + self.todo.insert(id); + } + } + fn add_id_checked(&mut self, id: &'a Id, valid: fn(Kind) -> bool, expected: &str) { if let Some(kind) = self.kind_of(id) { if valid(kind) { |
