diff options
| author | ouz-a <oguz.agcayazi@gmail.com> | 2022-05-12 00:27:06 +0300 |
|---|---|---|
| committer | ouz-a <oguz.agcayazi@gmail.com> | 2022-07-22 17:32:50 +0300 |
| commit | c0e4230bf5596d83d61c7a4ca5b06f0490ac4dba (patch) | |
| tree | 8fc6ffab0af955c639e321be1eca58c4ae31abdc /compiler/rustc_codegen_ssa | |
| parent | 41419e70366962c9a878bfe673ef4df38db6f7f1 (diff) | |
| download | rust-c0e4230bf5596d83d61c7a4ca5b06f0490ac4dba.tar.gz rust-c0e4230bf5596d83d61c7a4ca5b06f0490ac4dba.zip | |
simplify some code that depend on Deref
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/place.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs index 58cee0c8bb0..38e09f539de 100644 --- a/compiler/rustc_codegen_ssa/src/mir/place.rs +++ b/compiler/rustc_codegen_ssa/src/mir/place.rs @@ -435,16 +435,11 @@ 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.ret_deref().is_some() { + 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()) |
