diff options
| author | bors <bors@rust-lang.org> | 2022-07-25 22:57:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-07-25 22:57:23 +0000 |
| commit | a86705942c4cfaaee60f2e7308ca2bca703a710f (patch) | |
| tree | 133bd48f82d214929324a7e2337871b505adb8e5 /compiler/rustc_codegen_ssa/src | |
| parent | 6dbae3ad19309bb541d9e76638e6aa4b5449f29a (diff) | |
| parent | e58bfacd90bea9fab8bdbd9cf6129290937fed63 (diff) | |
| download | rust-a86705942c4cfaaee60f2e7308ca2bca703a710f.tar.gz rust-a86705942c4cfaaee60f2e7308ca2bca703a710f.zip | |
Auto merge of #99735 - JohnTitor:rollup-d93jyr2, r=JohnTitor
Rollup of 9 pull requests Successful merges: - #92390 (Constify a few `(Partial)Ord` impls) - #97077 (Simplify some code that depend on Deref) - #98710 (correct the output of a `capacity` method example) - #99084 (clarify how write_bytes can lead to UB due to invalid values) - #99178 (Lighten up const_prop_lint, reusing const_prop) - #99673 (don't ICE on invalid dyn calls) - #99703 (Expose size_hint() for TokenStream's iterator) - #99709 (`Inherited` always has `TypeckResults` available) - #99713 (Fix sidebar background) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/place.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs index 58cee0c8bb0..268c4d76503 100644 --- a/compiler/rustc_codegen_ssa/src/mir/place.rs +++ b/compiler/rustc_codegen_ssa/src/mir/place.rs @@ -435,18 +435,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { LocalRef::Place(place) => place, LocalRef::UnsizedPlace(place) => bx.load_operand(place).deref(cx), LocalRef::Operand(..) => { - if let Some(elem) = place_ref - .projection - .iter() - .enumerate() - .find(|elem| matches!(elem.1, mir::ProjectionElem::Deref)) - { - base = elem.0 + 1; + if place_ref.has_deref() { + base = 1; let cg_base = self.codegen_consume( bx, - mir::PlaceRef { projection: &place_ref.projection[..elem.0], ..place_ref }, + mir::PlaceRef { projection: &place_ref.projection[..0], ..place_ref }, ); - cg_base.deref(bx.cx()) } else { bug!("using operand local {:?} as place", place_ref); |
