Address comments
This commit is contained in:
parent
ffce4fbd6c
commit
64c2a310e1
@ -1549,8 +1549,12 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
|
|||||||
// but we only return `true` for types that are definitely uninhabited.
|
// but we only return `true` for types that are definitely uninhabited.
|
||||||
match self.sty {
|
match self.sty {
|
||||||
ty::Never => true,
|
ty::Never => true,
|
||||||
|
ty::Adt(def, _) if def.is_union() => {
|
||||||
|
// For now, `union`s are never considered uninhabited.
|
||||||
|
false
|
||||||
|
}
|
||||||
ty::Adt(def, _) => {
|
ty::Adt(def, _) => {
|
||||||
// Any ADT is uninhabited if:
|
// Any ADT is uninhabited if either:
|
||||||
// (a) It has no variants (i.e. an empty `enum`);
|
// (a) It has no variants (i.e. an empty `enum`);
|
||||||
// (b) Each of its variants (a single one in the case of a `struct`) has at least
|
// (b) Each of its variants (a single one in the case of a `struct`) has at least
|
||||||
// one uninhabited field.
|
// one uninhabited field.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user