]> git.lizzy.rs Git - rust.git/commitdiff
Never mark unions as uninhabited. Although I think this is wrong, it is certainly...
authorJonathan S <gereeter+code@gmail.com>
Thu, 21 Dec 2017 01:36:41 +0000 (19:36 -0600)
committerJonathan S <gereeter+code@gmail.com>
Thu, 21 Dec 2017 01:36:41 +0000 (19:36 -0600)
src/librustc/ty/layout.rs

index 68aa553c529a682d6eb38489f750b0155c072079..b46a7585945c7cd523ce38bad5eb6cff19d11811 100644 (file)
@@ -1361,11 +1361,6 @@ enum StructKind {
                         bug!("Union must be represented as a single variant");
                     }
 
-                    if variants[0].iter().all(|f| f.abi == Abi::Uninhabited) {
-                        // Uninhabited because it has only uninhabited variants/fields.
-                        return Ok(tcx.intern_layout(LayoutDetails::uninhabited(0)));
-                    }
-
                     let mut align = if def.repr.packed() {
                         dl.i8_align
                     } else {