From f90033303b491bdd4c89aa892a13323cf2ba941f Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 17 May 2018 18:16:59 +0100 Subject: [PATCH] Make sure the type we think is uninhabited actually is --- src/librustc_codegen_llvm/mir/block.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librustc_codegen_llvm/mir/block.rs b/src/librustc_codegen_llvm/mir/block.rs index bc5819791fa37..1669059a760f4 100644 --- a/src/librustc_codegen_llvm/mir/block.rs +++ b/src/librustc_codegen_llvm/mir/block.rs @@ -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, @@ -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;