Skip to content

Commit

Permalink
Never mark unions as uninhabited. Although I think this is wrong, it …
Browse files Browse the repository at this point in the history
…is certainly sound, and the general consensus seems to value not having footguns over some sort of aesthetic consistency.
  • Loading branch information
gereeter committed Dec 21, 2017
1 parent c1fe4a2 commit cbcf2ff
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/librustc/ty/layout.rs
Expand Up @@ -1361,11 +1361,6 @@ impl<'a, 'tcx> LayoutDetails {
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 {
Expand Down

0 comments on commit cbcf2ff

Please sign in to comment.