diff options
| author | Ralf Jung <post@ralfj.de> | 2019-12-05 14:38:24 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-12-05 14:38:24 +0100 |
| commit | e5d50e3e88f88e8a8b20e90bb0d561e1ed71fe5f (patch) | |
| tree | 7458a809c6b5f82d4fac541c59bf9589a31d8f26 /src/librustc_codegen_ssa/mir | |
| parent | e822235323ba4f732bf2bb930d1a430b70ba5501 (diff) | |
| download | rust-e5d50e3e88f88e8a8b20e90bb0d561e1ed71fe5f.tar.gz rust-e5d50e3e88f88e8a8b20e90bb0d561e1ed71fe5f.zip | |
comments
Diffstat (limited to 'src/librustc_codegen_ssa/mir')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/operand.rs | 5 | ||||
| -rw-r--r-- | 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 310b8aeb4db..a6dec812749 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 4b8819d11f4..b8ff2249dcb 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)) ); |
