Skip to content

Commit 55d2607

Browse files
committed
Address comments
1 parent 8223380 commit 55d2607

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
@@ -1510,8 +1510,12 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
15101510
// but we only return `true` for types that are definitely uninhabited.
15111511
match self.sty {
15121512
ty::Never => true,
1513+
ty::Adt(def, _) if def.is_union() => {
1514+
// For now, `union`s are never considered uninhabited.
1515+
false
1516+
}
15131517
ty::Adt(def, _) => {
1514-
// Any ADT is uninhabited if:
1518+
// Any ADT is uninhabited if either:
15151519
// (a) It has no variants (i.e. an empty `enum`);
15161520
// (b) Each of its variants (a single one in the case of a `struct`) has at least
15171521
// one uninhabited field.

src/librustc_codegen_llvm/mir/block.rs

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

0 commit comments

Comments
 (0)