diff options
| author | varkor <github@varkor.com> | 2018-09-14 22:46:13 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-12-11 11:18:55 +0000 |
| commit | 64c2a310e1bb489a97e6e8624201b632e31de5aa (patch) | |
| tree | 7494923d519fbc9d060315819d1832541c79ff0b | |
| parent | ffce4fbd6c7e1e2ac778cdb385cc9aca5e1bb6cb (diff) | |
| download | rust-64c2a310e1bb489a97e6e8624201b632e31de5aa.tar.gz rust-64c2a310e1bb489a97e6e8624201b632e31de5aa.zip | |
Address comments
| -rw-r--r-- | src/librustc/ty/sty.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 152d9a32303..46f22fa86a6 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1549,8 +1549,12 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { // but we only return `true` for types that are definitely uninhabited. match self.sty { ty::Never => true, + ty::Adt(def, _) if def.is_union() => { + // For now, `union`s are never considered uninhabited. + false + } ty::Adt(def, _) => { - // Any ADT is uninhabited if: + // Any ADT is uninhabited if either: // (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 // one uninhabited field. |
