From 4891aaf2e92264724bfb48a43cffbca14b942c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20BRANSTETT?= Date: Fri, 8 Oct 2021 16:53:39 +0200 Subject: [PATCH] Remove special-casing of never primitive in rustdoc-json-types --- src/librustdoc/json/conversions.rs | 1 - src/librustdoc/json/mod.rs | 2 +- src/rustdoc-json-types/lib.rs | 2 -- src/test/rustdoc-json/primitives.rs | 22 ++++++++++++++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/test/rustdoc-json/primitives.rs diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 731fc4ff3ce..661453521d1 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -418,7 +418,6 @@ impl FromWithTcx for Type { } } Generic(s) => Type::Generic(s.to_string()), - Primitive(clean::PrimitiveType::Never) => Type::Never, Primitive(p) => Type::Primitive(p.as_sym().to_string()), BareFunction(f) => Type::FunctionPointer(Box::new((*f).into_tcx(tcx))), Tuple(t) => Type::Tuple(t.into_iter().map(|x| x.into_tcx(tcx)).collect()), diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 040a880ace9..bef610867b6 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -255,7 +255,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { ) }) .collect(), - format_version: 8, + format_version: 9, }; let mut p = self.out_path.clone(); p.push(output.index.get(&output.root).unwrap().name.clone().unwrap()); diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 22debd296c2..7c418697c1c 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -388,8 +388,6 @@ pub enum Type { }, /// `impl TraitA + TraitB + ...` ImplTrait(Vec), - /// `!` - Never, /// `_` Infer, /// `*mut u32`, `*u8`, etc. diff --git a/src/test/rustdoc-json/primitives.rs b/src/test/rustdoc-json/primitives.rs new file mode 100644 index 00000000000..fd04f04da06 --- /dev/null +++ b/src/test/rustdoc-json/primitives.rs @@ -0,0 +1,22 @@ +#![feature(never_type)] + +// @has primitives.json "$.index[*][?(@.name=='PrimNever')].visibility" \"public\" +// @has - "$.index[*][?(@.name=='PrimNever')].inner.type.kind" \"primitive\" +// @has - "$.index[*][?(@.name=='PrimNever')].inner.type.inner" \"never\" +pub type PrimNever = !; + +// @has - "$.index[*][?(@.name=='PrimStr')].inner.type.kind" \"primitive\" +// @has - "$.index[*][?(@.name=='PrimStr')].inner.type.inner" \"str\" +pub type PrimStr = str; + +// @has - "$.index[*][?(@.name=='PrimBool')].inner.type.kind" \"primitive\" +// @has - "$.index[*][?(@.name=='PrimBool')].inner.type.inner" \"bool\" +pub type PrimBool = bool; + +// @has - "$.index[*][?(@.name=='PrimChar')].inner.type.kind" \"primitive\" +// @has - "$.index[*][?(@.name=='PrimChar')].inner.type.inner" \"char\" +pub type PrimChar = char; + +// @has - "$.index[*][?(@.name=='PrimU8')].inner.type.kind" \"primitive\" +// @has - "$.index[*][?(@.name=='PrimU8')].inner.type.inner" \"u8\" +pub type PrimU8 = u8;