Rollup merge of #89669 - Urgau:json-remove-type-never, r=GuillaumeGomez

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

Fixes https://github.com/rust-lang/rust/issues/89349

r? `@GuillaumeGomez`
This commit is contained in:
Guillaume Gomez 2021-10-08 22:30:42 +02:00 committed by GitHub
commit 4adc8ea2ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()),
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()),

View File

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

View File

@ -388,8 +388,6 @@ pub enum Type {
},
/// `impl TraitA + TraitB + ...`
ImplTrait(Vec<GenericBound>),
/// `!`
Never,
/// `_`
Infer,
/// `*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;