Skip to content

Commit 0444843

Browse files
committed
Address comments
1 parent 681057c commit 0444843

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/librustc/ty/sty.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,8 +1495,12 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
14951495
// but we only return `true` for types that are definitely uninhabited.
14961496
match self.sty {
14971497
ty::Never => true,
1498+
ty::Adt(def, _) if def.is_union() => {
1499+
// For now, `union`s are never considered uninhabited.
1500+
false
1501+
}
14981502
ty::Adt(def, _) => {
1499-
// Any ADT is uninhabited if:
1503+
// Any ADT is uninhabited if either:
15001504
// (a) It has no variants (i.e. an empty `enum`);
15011505
// (b) Each of its variants (a single one in the case of a `struct`) has at least
15021506
// one uninhabited field.

src/librustc_codegen_llvm/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
457457
// we can do what we like. Here, we declare that transmuting
458458
// into an uninhabited type is impossible, so anything following
459459
// it must be unreachable.
460-
assert!(sig.output().conservative_is_uninhabited(bx.tcx()));
460+
assert_eq!(bx.cx.layout_of(sig.output()).abi, layout::Abi::Uninhabited);
461461
bx.unreachable();
462462
}
463463
return;

0 commit comments

Comments
 (0)