Skip to content

Commit 64c2a31

Browse files
committedDec 11, 2018
Address comments
1 parent ffce4fb commit 64c2a31

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎src/librustc/ty/sty.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1549,8 +1549,12 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
15491549
// but we only return `true` for types that are definitely uninhabited.
15501550
match self.sty {
15511551
ty::Never => true,
1552+
ty::Adt(def, _) if def.is_union() => {
1553+
// For now, `union`s are never considered uninhabited.
1554+
false
1555+
}
15521556
ty::Adt(def, _) => {
1553-
// Any ADT is uninhabited if:
1557+
// Any ADT is uninhabited if either:
15541558
// (a) It has no variants (i.e. an empty `enum`);
15551559
// (b) Each of its variants (a single one in the case of a `struct`) has at least
15561560
// one uninhabited field.

0 commit comments

Comments
 (0)
Please sign in to comment.