1
Fork 0

Remove special-casing of never primitive in rustdoc-json-types

This commit is contained in:
Loïc BRANSTETT 2021-10-08 16:53:39 +02:00
parent 44995f7afb
commit 4891aaf2e9
4 changed files with 23 additions and 4 deletions

View file

@ -418,7 +418,6 @@ impl FromWithTcx<clean::Type> for Type {
} }
} }
Generic(s) => Type::Generic(s.to_string()), Generic(s) => Type::Generic(s.to_string()),
Primitive(clean::PrimitiveType::Never) => Type::Never,
Primitive(p) => Type::Primitive(p.as_sym().to_string()), Primitive(p) => Type::Primitive(p.as_sym().to_string()),
BareFunction(f) => Type::FunctionPointer(Box::new((*f).into_tcx(tcx))), BareFunction(f) => Type::FunctionPointer(Box::new((*f).into_tcx(tcx))),
Tuple(t) => Type::Tuple(t.into_iter().map(|x| x.into_tcx(tcx)).collect()), Tuple(t) => Type::Tuple(t.into_iter().map(|x| x.into_tcx(tcx)).collect()),

View file

@ -255,7 +255,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
) )
}) })
.collect(), .collect(),
format_version: 8, format_version: 9,
}; };
let mut p = self.out_path.clone(); let mut p = self.out_path.clone();
p.push(output.index.get(&output.root).unwrap().name.clone().unwrap()); p.push(output.index.get(&output.root).unwrap().name.clone().unwrap());

View file

@ -388,8 +388,6 @@ pub enum Type {
}, },
/// `impl TraitA + TraitB + ...` /// `impl TraitA + TraitB + ...`
ImplTrait(Vec<GenericBound>), ImplTrait(Vec<GenericBound>),
/// `!`
Never,
/// `_` /// `_`
Infer, Infer,
/// `*mut u32`, `*u8`, etc. /// `*mut u32`, `*u8`, etc.

View file

@ -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;