Skip to content

Commit

Permalink
Make sure the type we think is uninhabited actually is
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed May 17, 2018
1 parent 05067cf commit f900333
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librustc_codegen_llvm/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
if intrinsic == Some("transmute") {
if let Some(destination_ref) = destination.as_ref() {
let &(ref dest, target) = destination_ref;
self.trans_transmute(&bx, &args[0], dest);
self.codegen_transmute(&bx, &args[0], dest);
funclet_br(self, bx, target);
} else {
// If we are trying to transmute to an uninhabited type,
Expand All @@ -439,6 +439,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
// we can do what we like. Here, we declare that transmuting
// into an uninhabited type is impossible, so anything following
// it must be unreachable.
assert_eq!(bx.cx.layout_of(sig.output()).abi, layout::Abi::Uninhabited);
bx.unreachable();
}
return;
Expand Down

0 comments on commit f900333

Please sign in to comment.