Remove Never variant from clean::Type enum
This commit is contained in:
parent
6df1d82869
commit
bdd34717b8
5 changed files with 6 additions and 8 deletions
|
@ -1313,7 +1313,7 @@ impl Clean<Type> for hir::Ty<'_> {
|
||||||
use rustc_hir::*;
|
use rustc_hir::*;
|
||||||
|
|
||||||
match self.kind {
|
match self.kind {
|
||||||
TyKind::Never => Never,
|
TyKind::Never => Primitive(PrimitiveType::Never),
|
||||||
TyKind::Ptr(ref m) => RawPointer(m.mutbl, box m.ty.clean(cx)),
|
TyKind::Ptr(ref m) => RawPointer(m.mutbl, box m.ty.clean(cx)),
|
||||||
TyKind::Rptr(ref l, ref m) => {
|
TyKind::Rptr(ref l, ref m) => {
|
||||||
// There are two times a `Fresh` lifetime can be created:
|
// There are two times a `Fresh` lifetime can be created:
|
||||||
|
@ -1402,7 +1402,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
||||||
trace!("cleaning type: {:?}", self);
|
trace!("cleaning type: {:?}", self);
|
||||||
let ty = normalize(cx, self).unwrap_or(self);
|
let ty = normalize(cx, self).unwrap_or(self);
|
||||||
match *ty.kind() {
|
match *ty.kind() {
|
||||||
ty::Never => Never,
|
ty::Never => Primitive(PrimitiveType::Never),
|
||||||
ty::Bool => Primitive(PrimitiveType::Bool),
|
ty::Bool => Primitive(PrimitiveType::Bool),
|
||||||
ty::Char => Primitive(PrimitiveType::Char),
|
ty::Char => Primitive(PrimitiveType::Char),
|
||||||
ty::Int(int_ty) => Primitive(int_ty.into()),
|
ty::Int(int_ty) => Primitive(int_ty.into()),
|
||||||
|
|
|
@ -1396,7 +1396,6 @@ crate enum Type {
|
||||||
Slice(Box<Type>),
|
Slice(Box<Type>),
|
||||||
/// The `String` field is about the size or the constant representing the array's length.
|
/// The `String` field is about the size or the constant representing the array's length.
|
||||||
Array(Box<Type>, String),
|
Array(Box<Type>, String),
|
||||||
Never,
|
|
||||||
RawPointer(Mutability, Box<Type>),
|
RawPointer(Mutability, Box<Type>),
|
||||||
BorrowedRef {
|
BorrowedRef {
|
||||||
lifetime: Option<Lifetime>,
|
lifetime: Option<Lifetime>,
|
||||||
|
@ -1462,7 +1461,6 @@ impl Type {
|
||||||
}
|
}
|
||||||
RawPointer(..) => Some(PrimitiveType::RawPointer),
|
RawPointer(..) => Some(PrimitiveType::RawPointer),
|
||||||
BareFunction(..) => Some(PrimitiveType::Fn),
|
BareFunction(..) => Some(PrimitiveType::Fn),
|
||||||
Never => Some(PrimitiveType::Never),
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1550,7 +1548,6 @@ impl Type {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BareFunction(..) => PrimitiveType::Fn,
|
BareFunction(..) => PrimitiveType::Fn,
|
||||||
Never => PrimitiveType::Never,
|
|
||||||
Slice(..) => PrimitiveType::Slice,
|
Slice(..) => PrimitiveType::Slice,
|
||||||
Array(..) => PrimitiveType::Array,
|
Array(..) => PrimitiveType::Array,
|
||||||
RawPointer(..) => PrimitiveType::RawPointer,
|
RawPointer(..) => PrimitiveType::RawPointer,
|
||||||
|
|
|
@ -761,6 +761,9 @@ fn fmt_type<'cx>(
|
||||||
fmt::Display::fmt(&tybounds(bounds, lt, cx), f)
|
fmt::Display::fmt(&tybounds(bounds, lt, cx), f)
|
||||||
}
|
}
|
||||||
clean::Infer => write!(f, "_"),
|
clean::Infer => write!(f, "_"),
|
||||||
|
clean::Primitive(clean::PrimitiveType::Never) => {
|
||||||
|
primitive_link(f, PrimitiveType::Never, "!", cx)
|
||||||
|
}
|
||||||
clean::Primitive(prim) => primitive_link(f, prim, &*prim.as_sym().as_str(), cx),
|
clean::Primitive(prim) => primitive_link(f, prim, &*prim.as_sym().as_str(), cx),
|
||||||
clean::BareFunction(ref decl) => {
|
clean::BareFunction(ref decl) => {
|
||||||
if f.alternate() {
|
if f.alternate() {
|
||||||
|
@ -819,7 +822,6 @@ fn fmt_type<'cx>(
|
||||||
primitive_link(f, PrimitiveType::Array, &format!("; {}]", Escape(n)), cx)
|
primitive_link(f, PrimitiveType::Array, &format!("; {}]", Escape(n)), cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clean::Never => primitive_link(f, PrimitiveType::Never, "!", cx),
|
|
||||||
clean::RawPointer(m, ref t) => {
|
clean::RawPointer(m, ref t) => {
|
||||||
let m = match m {
|
let m = match m {
|
||||||
hir::Mutability::Mut => "mut",
|
hir::Mutability::Mut => "mut",
|
||||||
|
|
|
@ -244,7 +244,6 @@ fn get_index_type_name(clean_type: &clean::Type, accept_generic: bool) -> Option
|
||||||
| clean::Tuple(_)
|
| clean::Tuple(_)
|
||||||
| clean::Slice(_)
|
| clean::Slice(_)
|
||||||
| clean::Array(_, _)
|
| clean::Array(_, _)
|
||||||
| clean::Never
|
|
||||||
| clean::RawPointer(_, _)
|
| clean::RawPointer(_, _)
|
||||||
| clean::QPath { .. }
|
| clean::QPath { .. }
|
||||||
| clean::Infer
|
| clean::Infer
|
||||||
|
|
|
@ -417,13 +417,13 @@ 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()),
|
||||||
Slice(t) => Type::Slice(Box::new((*t).into_tcx(tcx))),
|
Slice(t) => Type::Slice(Box::new((*t).into_tcx(tcx))),
|
||||||
Array(t, s) => Type::Array { type_: Box::new((*t).into_tcx(tcx)), len: s },
|
Array(t, s) => Type::Array { type_: Box::new((*t).into_tcx(tcx)), len: s },
|
||||||
ImplTrait(g) => Type::ImplTrait(g.into_iter().map(|x| x.into_tcx(tcx)).collect()),
|
ImplTrait(g) => Type::ImplTrait(g.into_iter().map(|x| x.into_tcx(tcx)).collect()),
|
||||||
Never => Type::Never,
|
|
||||||
Infer => Type::Infer,
|
Infer => Type::Infer,
|
||||||
RawPointer(mutability, type_) => Type::RawPointer {
|
RawPointer(mutability, type_) => Type::RawPointer {
|
||||||
mutable: mutability == ast::Mutability::Mut,
|
mutable: mutability == ast::Mutability::Mut,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue