From e5d50e3e88f88e8a8b20e90bb0d561e1ed71fe5f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 5 Dec 2019 14:38:24 +0100 Subject: [PATCH] comments --- src/librustc_codegen_ssa/mir/operand.rs | 5 +++-- src/librustc_codegen_ssa/mir/place.rs | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs index 310b8aeb4db09..a6dec81274915 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -475,9 +475,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { }, } // Allow RalfJ to sleep soundly knowing that even refactorings that remove - // the above error (or silence it under some conditions) will not cause UB + // the above error (or silence it under some conditions) will not cause UB. bx.abort(); - // We've errored, so we don't have to produce working code. + // We still have to return an operand but it doesn't matter, + // this code is unreachable. let ty = self.monomorphize(&constant.literal.ty); let layout = bx.cx().layout_of(ty); bx.load_operand(PlaceRef::new_sized( diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index 4b8819d11f4f8..b8ff2249dcb04 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -493,6 +493,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // With floats that won't always be true, // so we generate a (safe) abort. bx.abort(); + // We still have to return a place but it doesn't matter, + // this code is unreachable. let llval = bx.cx().const_undef( bx.cx().type_ptr_to(bx.cx().backend_type(layout)) );