Skip to content

Commit cbcf2ff

Browse files
committed
Never mark unions as uninhabited. Although I think this is wrong, it is certainly sound, and the general consensus seems to value not having footguns over some sort of aesthetic consistency.
1 parent c1fe4a2 commit cbcf2ff

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

src/librustc/ty/layout.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1361,11 +1361,6 @@ impl<'a, 'tcx> LayoutDetails {
13611361
bug!("Union must be represented as a single variant");
13621362
}
13631363

1364-
if variants[0].iter().all(|f| f.abi == Abi::Uninhabited) {
1365-
// Uninhabited because it has only uninhabited variants/fields.
1366-
return Ok(tcx.intern_layout(LayoutDetails::uninhabited(0)));
1367-
}
1368-
13691364
let mut align = if def.repr.packed() {
13701365
dl.i8_align
13711366
} else {

0 commit comments

Comments
 (0)