]> git.lizzy.rs Git - rust.git/commitdiff
Place::as_place_ref is now Place::as_ref
authorSantiago Pastorino <spastorino@gmail.com>
Sun, 21 Jul 2019 20:38:30 +0000 (22:38 +0200)
committerSantiago Pastorino <spastorino@gmail.com>
Sun, 21 Jul 2019 22:25:07 +0000 (00:25 +0200)
22 files changed:
src/librustc/mir/mod.rs
src/librustc_codegen_ssa/mir/analyze.rs
src/librustc_codegen_ssa/mir/block.rs
src/librustc_codegen_ssa/mir/operand.rs
src/librustc_codegen_ssa/mir/rvalue.rs
src/librustc_codegen_ssa/mir/statement.rs
src/librustc_mir/borrow_check/conflict_errors.rs
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/move_errors.rs
src/librustc_mir/borrow_check/mutability_errors.rs
src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
src/librustc_mir/borrow_check/path_utils.rs
src/librustc_mir/borrow_check/places_conflict.rs
src/librustc_mir/build/matches/mod.rs
src/librustc_mir/dataflow/drop_flag_effects.rs
src/librustc_mir/dataflow/impls/mod.rs
src/librustc_mir/dataflow/move_paths/builder.rs
src/librustc_mir/transform/add_retag.rs
src/librustc_mir/transform/elaborate_drops.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/rustc_peek.rs

index d8b641fbe31f483dc1649f5aec61aa8d0dca704d..75f03949d995b11f609e6369faf64f605ddab47f 100644 (file)
@@ -1931,7 +1931,7 @@ fn iterate_over2<'tcx, R>(
         iterate_over2(place_base, place_projection, &Projections::Empty, op)
     }
 
-    pub fn as_place_ref(&self) -> PlaceRef<'_, 'tcx> {
+    pub fn as_ref(&self) -> PlaceRef<'_, 'tcx> {
         PlaceRef {
             base: &self.base,
             projection: &self.projection,
index 09c346117f9d92ee14a6da3d7aefd21b872bf1ad..907689541f97884ba0d60d8e662b24a56eb31070 100644 (file)
@@ -238,7 +238,7 @@ fn visit_place(&mut self,
                    context: PlaceContext,
                    location: Location) {
         debug!("visit_place(place={:?}, context={:?})", place, context);
-        self.process_place(&place.as_place_ref(), context, location);
+        self.process_place(&place.as_ref(), context, location);
     }
 
     fn visit_local(&mut self,
index d4b434ffe809c217b8807f546991a407bab43c4c..54afefd1a64e2a25b435f7a730f4851c4154d505 100644 (file)
@@ -253,7 +253,7 @@ fn codegen_return_terminator(&mut self, mut bx: Bx) {
 
             PassMode::Direct(_) | PassMode::Pair(..) => {
                 let op =
-                    self.codegen_consume(&mut bx, &mir::Place::RETURN_PLACE.as_place_ref());
+                    self.codegen_consume(&mut bx, &mir::Place::RETURN_PLACE.as_ref());
                 if let Ref(llval, _, align) = op.val {
                     bx.load(llval, align)
                 } else {
@@ -314,7 +314,7 @@ fn codegen_drop_terminator<'b>(
             return
         }
 
-        let place = self.codegen_place(&mut bx, &location.as_place_ref());
+        let place = self.codegen_place(&mut bx, &location.as_ref());
         let (args1, args2);
         let mut args = if let Some(llextra) = place.llextra {
             args2 = [place.llval, llextra];
@@ -1171,7 +1171,7 @@ fn codegen_transmute(
                 LocalRef::Place(place) => self.codegen_transmute_into(bx, src, place),
                 LocalRef::UnsizedPlace(_) => bug!("transmute must not involve unsized locals"),
                 LocalRef::Operand(None) => {
-                    let dst_layout = bx.layout_of(self.monomorphized_place_ty(&dst.as_place_ref()));
+                    let dst_layout = bx.layout_of(self.monomorphized_place_ty(&dst.as_ref()));
                     assert!(!dst_layout.ty.has_erasable_regions());
                     let place = PlaceRef::alloca(bx, dst_layout, "transmute_temp");
                     place.storage_live(bx);
@@ -1186,7 +1186,7 @@ fn codegen_transmute(
                 }
             }
         } else {
-            let dst = self.codegen_place(bx, &dst.as_place_ref());
+            let dst = self.codegen_place(bx, &dst.as_ref());
             self.codegen_transmute_into(bx, src, dst);
         }
     }
index 0f6a95c1968b8cc0da05db2d0ceab443ced761cf..302dcfcc682a3e423088ba35c6a8c219f21ef9e9 100644 (file)
@@ -462,7 +462,7 @@ pub fn codegen_operand(
         match *operand {
             mir::Operand::Copy(ref place) |
             mir::Operand::Move(ref place) => {
-                self.codegen_consume(bx, &place.as_place_ref())
+                self.codegen_consume(bx, &place.as_ref())
             }
 
             mir::Operand::Constant(ref constant) => {
index cfb7db7365802e3c8dc254ca718f19309640eb77..202cf147f1fcbcefa8fce6fe83555acd4235399a 100644 (file)
@@ -355,7 +355,7 @@ pub fn codegen_rvalue_operand(
             }
 
             mir::Rvalue::Ref(_, bk, ref place) => {
-                let cg_place = self.codegen_place(&mut bx, &place.as_place_ref());
+                let cg_place = self.codegen_place(&mut bx, &place.as_ref());
 
                 let ty = cg_place.layout.ty;
 
@@ -446,7 +446,7 @@ pub fn codegen_rvalue_operand(
 
             mir::Rvalue::Discriminant(ref place) => {
                 let discr_ty = rvalue.ty(&*self.mir, bx.tcx());
-                let discr =  self.codegen_place(&mut bx, &place.as_place_ref())
+                let discr =  self.codegen_place(&mut bx, &place.as_ref())
                     .codegen_get_discr(&mut bx, discr_ty);
                 (bx, OperandRef {
                     val: OperandValue::Immediate(discr),
@@ -527,7 +527,7 @@ fn evaluate_array_len(
             }
         }
         // use common size calculation for non zero-sized types
-        let cg_value = self.codegen_place(bx, &place.as_place_ref());
+        let cg_value = self.codegen_place(bx, &place.as_ref());
         cg_value.len(bx.cx())
     }
 
index 499cda1cf8449b02e0cc359755490cf3ea4e4f41..3717be4b4175338fb1200a4f36c999ae50bd90c3 100644 (file)
@@ -46,12 +46,12 @@ pub fn codegen_statement(
                         }
                     }
                 } else {
-                    let cg_dest = self.codegen_place(&mut bx, &place.as_place_ref());
+                    let cg_dest = self.codegen_place(&mut bx, &place.as_ref());
                     self.codegen_rvalue(bx, cg_dest, rvalue)
                 }
             }
             mir::StatementKind::SetDiscriminant{ref place, variant_index} => {
-                self.codegen_place(&mut bx, &place.as_place_ref())
+                self.codegen_place(&mut bx, &place.as_ref())
                     .codegen_set_discr(&mut bx, variant_index);
                 bx
             }
@@ -73,7 +73,7 @@ pub fn codegen_statement(
             }
             mir::StatementKind::InlineAsm(ref asm) => {
                 let outputs = asm.outputs.iter().map(|output| {
-                    self.codegen_place(&mut bx, &output.as_place_ref())
+                    self.codegen_place(&mut bx, &output.as_ref())
                 }).collect();
 
                 let input_vals = asm.inputs.iter()
index 95fc22dc5eb766c6636314341cf97e829745c07e..5d0e490ebea5a0549ae4e43bfa4b9d994d66bfee 100644 (file)
@@ -139,14 +139,14 @@ pub(super) fn report_use_of_moved_or_uninitialized(
             let is_partial_move = move_site_vec.iter().any(|move_site| {
                 let move_out = self.move_data.moves[(*move_site).moi];
                 let moved_place = &self.move_data.move_paths[move_out.path].place;
-                used_place != moved_place.as_place_ref()
-                    && used_place.is_prefix_of(moved_place.as_place_ref())
+                used_place != moved_place.as_ref()
+                    && used_place.is_prefix_of(moved_place.as_ref())
             });
             for move_site in &move_site_vec {
                 let move_out = self.move_data.moves[(*move_site).moi];
                 let moved_place = &self.move_data.move_paths[move_out.path].place;
 
-                let move_spans = self.move_spans(moved_place.as_place_ref(), move_out.source);
+                let move_spans = self.move_spans(moved_place.as_ref(), move_out.source);
                 let move_span = move_spans.args_or_use();
 
                 let move_msg = if move_spans.for_closure() {
@@ -223,7 +223,7 @@ pub(super) fn report_use_of_moved_or_uninitialized(
 
                 let ty = place.ty(self.body, self.infcx.tcx).ty;
                 let opt_name =
-                    self.describe_place_with_options(place.as_place_ref(), IncludingDowncast(true));
+                    self.describe_place_with_options(place.as_ref(), IncludingDowncast(true));
                 let note_msg = match opt_name {
                     Some(ref name) => format!("`{}`", name),
                     None => "value".to_owned(),
@@ -275,11 +275,11 @@ pub(super) fn report_move_out_while_borrowed(
             "report_move_out_while_borrowed: location={:?} place={:?} span={:?} borrow={:?}",
             location, place, span, borrow
         );
-        let value_msg = match self.describe_place(place.as_place_ref()) {
+        let value_msg = match self.describe_place(place.as_ref()) {
             Some(name) => format!("`{}`", name),
             None => "value".to_owned(),
         };
-        let borrow_msg = match self.describe_place(borrow.borrowed_place.as_place_ref()) {
+        let borrow_msg = match self.describe_place(borrow.borrowed_place.as_ref()) {
             Some(name) => format!("`{}`", name),
             None => "value".to_owned(),
         };
@@ -287,12 +287,12 @@ pub(super) fn report_move_out_while_borrowed(
         let borrow_spans = self.retrieve_borrow_spans(borrow);
         let borrow_span = borrow_spans.args_or_use();
 
-        let move_spans = self.move_spans(place.as_place_ref(), location);
+        let move_spans = self.move_spans(place.as_ref(), location);
         let span = move_spans.args_or_use();
 
         let mut err = self.cannot_move_when_borrowed(
             span,
-            &self.describe_place(place.as_place_ref()).unwrap_or_else(|| "_".to_owned()),
+            &self.describe_place(place.as_ref()).unwrap_or_else(|| "_".to_owned()),
         );
         err.span_label(borrow_span, format!("borrow of {} occurs here", borrow_msg));
         err.span_label(span, format!("move out of {} occurs here", value_msg));
@@ -326,21 +326,21 @@ pub(super) fn report_use_while_mutably_borrowed(
 
         // Conflicting borrows are reported separately, so only check for move
         // captures.
-        let use_spans = self.move_spans(place.as_place_ref(), location);
+        let use_spans = self.move_spans(place.as_ref(), location);
         let span = use_spans.var_or_use();
 
         let mut err = self.cannot_use_when_mutably_borrowed(
             span,
-            &self.describe_place(place.as_place_ref()).unwrap_or_else(|| "_".to_owned()),
+            &self.describe_place(place.as_ref()).unwrap_or_else(|| "_".to_owned()),
             borrow_span,
-            &self.describe_place(borrow.borrowed_place.as_place_ref())
+            &self.describe_place(borrow.borrowed_place.as_ref())
                 .unwrap_or_else(|| "_".to_owned()),
         );
 
         borrow_spans.var_span_label(&mut err, {
             let place = &borrow.borrowed_place;
             let desc_place =
-                self.describe_place(place.as_place_ref()).unwrap_or_else(|| "_".to_owned());
+                self.describe_place(place.as_ref()).unwrap_or_else(|| "_".to_owned());
 
             format!("borrow occurs due to use of `{}`{}", desc_place, borrow_spans.describe())
         });
@@ -517,7 +517,7 @@ pub(super) fn report_conflicting_borrow(
             );
         } else {
             let borrow_place = &issued_borrow.borrowed_place;
-            let borrow_place_desc = self.describe_place(borrow_place.as_place_ref())
+            let borrow_place_desc = self.describe_place(borrow_place.as_ref())
                                         .unwrap_or_else(|| "_".to_owned());
             issued_spans.var_span_label(
                 &mut err,
@@ -650,8 +650,8 @@ pub(super) fn describe_place_for_conflicting_borrow(
 
                                 return Some((
                                     describe_base_place,
-                                    describe_place(first_borrowed_place.as_place_ref()),
-                                    describe_place(second_borrowed_place.as_place_ref()),
+                                    describe_place(first_borrowed_place.as_ref()),
+                                    describe_place(second_borrowed_place.as_ref()),
                                     union_ty.to_string(),
                                 ));
                             }
@@ -666,7 +666,7 @@ pub(super) fn describe_place_for_conflicting_borrow(
                 // If we didn't find a field access into a union, or both places match, then
                 // only return the description of the first place.
                 (
-                    describe_place(first_borrowed_place.as_place_ref()),
+                    describe_place(first_borrowed_place.as_ref()),
                     "".to_string(),
                     "".to_string(),
                     "".to_string(),
@@ -697,7 +697,7 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
         );
 
         let drop_span = place_span.1;
-        let root_place = self.prefixes(borrow.borrowed_place.as_place_ref(), PrefixSet::All)
+        let root_place = self.prefixes(borrow.borrowed_place.as_ref(), PrefixSet::All)
             .last()
             .unwrap();
 
@@ -730,13 +730,13 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
             }, borrow_span));
 
         if let StorageDeadOrDrop::Destructor(dropped_ty) =
-            self.classify_drop_access_kind(borrow.borrowed_place.as_place_ref())
+            self.classify_drop_access_kind(borrow.borrowed_place.as_ref())
         {
             // If a borrow of path `B` conflicts with drop of `D` (and
             // we're not in the uninteresting case where `B` is a
             // prefix of `D`), then report this as a more interesting
             // destructor conflict.
-            if !borrow.borrowed_place.as_place_ref().is_prefix_of(place_span.0.as_place_ref()) {
+            if !borrow.borrowed_place.as_ref().is_prefix_of(place_span.0.as_ref()) {
                 self.report_borrow_conflicts_with_destructor(
                     location, borrow, place_span, kind, dropped_ty,
                 );
@@ -744,7 +744,7 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
             }
         }
 
-        let place_desc = self.describe_place(borrow.borrowed_place.as_place_ref());
+        let place_desc = self.describe_place(borrow.borrowed_place.as_ref());
 
         let kind_place = kind.filter(|_| place_desc.is_some()).map(|k| (k, place_span.0));
         let explanation = self.explain_why_borrow_contains_point(location, &borrow, kind_place);
@@ -951,12 +951,12 @@ fn report_borrow_conflicts_with_destructor(
 
         let mut err = self.cannot_borrow_across_destructor(borrow_span);
 
-        let what_was_dropped = match self.describe_place(place.as_place_ref()) {
+        let what_was_dropped = match self.describe_place(place.as_ref()) {
             Some(name) => format!("`{}`", name.as_str()),
             None => String::from("temporary value"),
         };
 
-        let label = match self.describe_place(borrow.borrowed_place.as_place_ref()) {
+        let label = match self.describe_place(borrow.borrowed_place.as_ref()) {
             Some(borrowed) => format!(
                 "here, drop of {D} needs exclusive access to `{B}`, \
                  because the type `{T}` implements the `Drop` trait",
@@ -1127,7 +1127,7 @@ fn try_report_cannot_return_reference_to_local(
                 format!("`{}` is borrowed here", place_desc),
             )
         } else {
-            let root_place = self.prefixes(borrow.borrowed_place.as_place_ref(),
+            let root_place = self.prefixes(borrow.borrowed_place.as_ref(),
                                            PrefixSet::All)
                 .last()
                 .unwrap();
@@ -1390,7 +1390,7 @@ pub(super) fn report_illegal_mutation_of_borrowed(
             let mut err = self.cannot_mutate_in_match_guard(
                 span,
                 loan_span,
-                &self.describe_place(place.as_place_ref()).unwrap_or_else(|| "_".to_owned()),
+                &self.describe_place(place.as_ref()).unwrap_or_else(|| "_".to_owned()),
                 "assign",
             );
             loan_spans.var_span_label(
@@ -1406,7 +1406,7 @@ pub(super) fn report_illegal_mutation_of_borrowed(
         let mut err = self.cannot_assign_to_borrowed(
             span,
             loan_span,
-            &self.describe_place(place.as_place_ref()).unwrap_or_else(|| "_".to_owned()),
+            &self.describe_place(place.as_ref()).unwrap_or_else(|| "_".to_owned()),
         );
 
         loan_spans.var_span_label(
@@ -1466,8 +1466,8 @@ pub(super) fn report_illegal_reassignment(
                 is_user_variable: None,
                 ..
             })
-            | None => (self.describe_place(place.as_place_ref()), assigned_span),
-            Some(decl) => (self.describe_place(err_place.as_place_ref()), decl.source_info.span),
+            | None => (self.describe_place(place.as_ref()), assigned_span),
+            Some(decl) => (self.describe_place(err_place.as_ref()), decl.source_info.span),
         };
 
         let mut err = self.cannot_reassign_immutable(
index 156897aedb70acb18fda91793b98ec3f71362fba..a05c77aad6700903e86bedd213034f579be3162a 100644 (file)
@@ -855,7 +855,7 @@ pub(super) fn borrow_spans(&self, use_span: Span, location: Location) -> UseSpan
                     def_id, is_generator, places
                 );
                 if let Some((args_span, var_span)) = self.closure_span(
-                    *def_id, Place::from(target).as_place_ref(), places
+                    *def_id, Place::from(target).as_ref(), places
                 ) {
                     return ClosureUse {
                         is_generator,
@@ -895,7 +895,7 @@ fn closure_span(
             for (upvar, place) in self.infcx.tcx.upvars(def_id)?.values().zip(places) {
                 match place {
                     Operand::Copy(place) |
-                    Operand::Move(place) if target_place == place.as_place_ref() => {
+                    Operand::Move(place) if target_place == place.as_ref() => {
                         debug!("closure_span: found captured local {:?}", place);
                         return Some((*args_span, upvar.span));
                     },
index cfc7e77f4e5a87417c60a2b49756f866ca2bcc13..5ec1e514100de1c60d9192b5ede6781a7f4fbdd4 100644 (file)
@@ -560,7 +560,7 @@ fn visit_statement_entry(
                 self.check_if_path_or_subpath_is_moved(
                     location,
                     InitializationRequiringAction::Use,
-                    (place.as_place_ref(), span),
+                    (place.as_ref(), span),
                     flow_state,
                 );
             }
@@ -591,7 +591,7 @@ fn visit_statement_entry(
                         self.check_if_path_or_subpath_is_moved(
                             location,
                             InitializationRequiringAction::Use,
-                            (output.as_place_ref(), o.span),
+                            (output.as_ref(), o.span),
                             flow_state,
                         );
                     } else {
@@ -1154,7 +1154,7 @@ fn mutate_place(
                 self.check_if_path_or_subpath_is_moved(
                     location,
                     InitializationRequiringAction::Update,
-                    (place_span.0.as_place_ref(), place_span.1),
+                    (place_span.0.as_ref(), place_span.1),
                     flow_state,
                 );
             }
@@ -1232,7 +1232,7 @@ fn consume_rvalue(
                 self.check_if_path_or_subpath_is_moved(
                     location,
                     action,
-                    (place.as_place_ref(), span),
+                    (place.as_ref(), span),
                     flow_state,
                 );
             }
@@ -1260,7 +1260,7 @@ fn consume_rvalue(
                 self.check_if_path_or_subpath_is_moved(
                     location,
                     InitializationRequiringAction::Use,
-                    (place.as_place_ref(), span),
+                    (place.as_ref(), span),
                     flow_state,
                 );
             }
@@ -1309,7 +1309,7 @@ fn consume_rvalue(
     fn propagate_closure_used_mut_upvar(&mut self, operand: &Operand<'tcx>) {
         let propagate_closure_used_mut_place = |this: &mut Self, place: &Place<'tcx>| {
             if place.projection.is_some() {
-                if let Some(field) = this.is_upvar_field_projection(place.as_place_ref()) {
+                if let Some(field) = this.is_upvar_field_projection(place.as_ref()) {
                     this.used_mut_upvars.push(field);
                 }
             } else if let PlaceBase::Local(local) = place.base {
@@ -1401,7 +1401,7 @@ fn consume_operand(
                 self.check_if_path_or_subpath_is_moved(
                     location,
                     InitializationRequiringAction::Use,
-                    (place.as_place_ref(), span),
+                    (place.as_ref(), span),
                     flow_state,
                 );
             }
@@ -1419,7 +1419,7 @@ fn consume_operand(
                 self.check_if_path_or_subpath_is_moved(
                     location,
                     InitializationRequiringAction::Use,
-                    (place.as_place_ref(), span),
+                    (place.as_ref(), span),
                     flow_state,
                 );
             }
@@ -1437,7 +1437,7 @@ fn check_for_invalidation_at_exit(
     ) {
         debug!("check_for_invalidation_at_exit({:?})", borrow);
         let place = &borrow.borrowed_place;
-        let root_place = self.prefixes(place.as_place_ref(), PrefixSet::All).last().unwrap();
+        let root_place = self.prefixes(place.as_ref(), PrefixSet::All).last().unwrap();
 
         // FIXME(nll-rfc#40): do more precise destructor tracking here. For now
         // we just know that all locals are dropped at function exit (otherwise
index 38653dc0e5e9b79cf8596245ca84a1a2a35b3112..738a091b0dd7624c809df545a033708c627de49d 100644 (file)
@@ -131,7 +131,7 @@ fn append_to_grouped_errors(
                     }
                 }
 
-                let move_spans = self.move_spans(original_path.as_place_ref(), location);
+                let move_spans = self.move_spans(original_path.as_ref(), location);
                 grouped_errors.push(GroupedMoveError::OtherIllegalMove {
                     use_spans: move_spans,
                     original_path,
@@ -160,7 +160,7 @@ fn append_binding_error(
         let from_simple_let = match_place.is_none();
         let match_place = match_place.as_ref().unwrap_or(move_from);
 
-        match self.move_data.rev_lookup.find(match_place.as_place_ref()) {
+        match self.move_data.rev_lookup.find(match_place.as_ref()) {
             // Error with the match place
             LookupResult::Parent(_) => {
                 for ge in &mut *grouped_errors {
@@ -192,7 +192,7 @@ fn append_binding_error(
             }
             // Error with the pattern
             LookupResult::Exact(_) => {
-                let mpi = match self.move_data.rev_lookup.find(move_from.as_place_ref()) {
+                let mpi = match self.move_data.rev_lookup.find(move_from.as_ref()) {
                     LookupResult::Parent(Some(mpi)) => mpi,
                     // move_from should be a projection from match_place.
                     _ => unreachable!("Probably not unreachable..."),
@@ -242,7 +242,7 @@ fn report(&mut self, error: GroupedMoveError<'tcx>) {
                 };
             debug!("report: original_path={:?} span={:?}, kind={:?} \
                    original_path.is_upvar_field_projection={:?}", original_path, span, kind,
-                   self.is_upvar_field_projection(original_path.as_place_ref()));
+                   self.is_upvar_field_projection(original_path.as_ref()));
             (
                 match kind {
                     IllegalMoveOriginKind::Static => {
@@ -277,7 +277,7 @@ fn report_cannot_move_from_static(
         span: Span
     ) -> DiagnosticBuilder<'a> {
         let description = if place.projection.is_none() {
-            format!("static item `{}`", self.describe_place(place.as_place_ref()).unwrap())
+            format!("static item `{}`", self.describe_place(place.as_ref()).unwrap())
         } else {
             let mut base_static = &place.projection;
             while let Some(box Projection { base: Some(ref proj), .. }) = base_static {
@@ -290,7 +290,7 @@ fn report_cannot_move_from_static(
 
             format!(
                 "`{:?}` as `{:?}` is a static item",
-                self.describe_place(place.as_place_ref()).unwrap(),
+                self.describe_place(place.as_ref()).unwrap(),
                 self.describe_place(base_static).unwrap(),
             )
         };
@@ -308,7 +308,7 @@ fn report_cannot_move_from_borrowed_content(
         // borrow to provide feedback about why this
         // was a move rather than a copy.
         let ty = deref_target_place.ty(self.body, self.infcx.tcx).ty;
-        let upvar_field = self.prefixes(move_place.as_place_ref(), PrefixSet::All)
+        let upvar_field = self.prefixes(move_place.as_ref(), PrefixSet::All)
             .find_map(|p| self.is_upvar_field_projection(p));
 
         let deref_base = match deref_target_place.projection {
@@ -363,10 +363,10 @@ fn report_cannot_move_from_borrowed_content(
                 let upvar_name = upvar.name;
                 let upvar_span = self.infcx.tcx.hir().span(upvar_hir_id);
 
-                let place_name = self.describe_place(move_place.as_place_ref()).unwrap();
+                let place_name = self.describe_place(move_place.as_ref()).unwrap();
 
                 let place_description = if self
-                    .is_upvar_field_projection(move_place.as_place_ref())
+                    .is_upvar_field_projection(move_place.as_ref())
                     .is_some()
                 {
                     format!("`{}`, a {}", place_name, capture_description)
@@ -393,7 +393,7 @@ fn report_cannot_move_from_borrowed_content(
             _ => {
                 let source = self.borrowed_content_source(deref_base);
                 match (
-                    self.describe_place(move_place.as_place_ref()),
+                    self.describe_place(move_place.as_ref()),
                     source.describe_for_named_place(),
                 ) {
                     (Some(place_desc), Some(source_desc)) => {
@@ -455,7 +455,7 @@ fn add_move_hints(
 
                 if binds_to.is_empty() {
                     let place_ty = move_from.ty(self.body, self.infcx.tcx).ty;
-                    let place_desc = match self.describe_place(move_from.as_place_ref()) {
+                    let place_desc = match self.describe_place(move_from.as_ref()) {
                         Some(desc) => format!("`{}`", desc),
                         None => format!("value"),
                     };
@@ -483,7 +483,7 @@ fn add_move_hints(
             GroupedMoveError::OtherIllegalMove { ref original_path, use_spans, .. } => {
                 let span = use_spans.var_or_use();
                 let place_ty = original_path.ty(self.body, self.infcx.tcx).ty;
-                let place_desc = match self.describe_place(original_path.as_place_ref()) {
+                let place_desc = match self.describe_place(original_path.as_ref()) {
                     Some(desc) => format!("`{}`", desc),
                     None => format!("value"),
                 };
index c424c06c41add30a8986b77cab091cbc4ca59082..937c6383be341e50f3a5429440820650ce969147 100644 (file)
@@ -42,7 +42,7 @@ pub(super) fn report_mutability_error(
         let item_msg;
         let reason;
         let mut opt_source = None;
-        let access_place_desc = self.describe_place(access_place.as_place_ref());
+        let access_place_desc = self.describe_place(access_place.as_ref());
         debug!("report_mutability_error: access_place_desc={:?}", access_place_desc);
 
         match the_place_err {
@@ -77,7 +77,7 @@ pub(super) fn report_mutability_error(
                 ));
 
                 item_msg = format!("`{}`", access_place_desc.unwrap());
-                if self.is_upvar_field_projection(access_place.as_place_ref()).is_some() {
+                if self.is_upvar_field_projection(access_place.as_ref()).is_some() {
                     reason = ", as it is not declared as mutable".to_string();
                 } else {
                     let name = self.upvars[upvar_index.index()].name;
@@ -109,7 +109,7 @@ pub(super) fn report_mutability_error(
                     ));
 
                     reason =
-                        if self.is_upvar_field_projection(access_place.as_place_ref()).is_some() {
+                        if self.is_upvar_field_projection(access_place.as_ref()).is_some() {
                             ", as it is a captured variable in a `Fn` closure".to_string()
                         } else {
                             ", as `Fn` closures cannot mutate their captured variables".to_string()
@@ -244,7 +244,7 @@ pub(super) fn report_mutability_error(
                     format!(
                         "mutable borrow occurs due to use of `{}` in closure",
                         // always Some() if the message is printed.
-                        self.describe_place(access_place.as_place_ref()).unwrap_or_default(),
+                        self.describe_place(access_place.as_ref()).unwrap_or_default(),
                     )
                 );
                 borrow_span
index abb84c59d9b9e740b6febb840fd4a89bf6ccc893..aba3ef1cbbfc9a64ec41f9e2ee9f0bbdd2f77898 100644 (file)
@@ -252,7 +252,7 @@ pub(in crate::borrow_check) fn explain_why_borrow_contains_point(
             Some(Cause::LiveVar(local, location)) => {
                 let span = body.source_info(location).span;
                 let spans = self
-                    .move_spans(Place::from(local).as_place_ref(), location)
+                    .move_spans(Place::from(local).as_ref(), location)
                     .or_else(|| self.borrow_spans(span, location));
 
                 let borrow_location = location;
@@ -305,7 +305,7 @@ pub(in crate::borrow_check) fn explain_why_borrow_contains_point(
                         );
                     if let Some(region_name) = region_name {
                         let opt_place_desc =
-                            self.describe_place(borrow.borrowed_place.as_place_ref());
+                            self.describe_place(borrow.borrowed_place.as_ref());
                         BorrowExplanation::MustBeValidFor {
                             category,
                             from_closure,
index 75065816df0506363766dbda7f46b4ce34eec211..da3f165482655a9ffea313041c0753bed4649bbc 100644 (file)
@@ -50,7 +50,7 @@ pub(super) fn each_borrow_involving_path<'tcx, F, I, S>(
             body,
             &borrowed.borrowed_place,
             borrowed.kind,
-            place.as_place_ref(),
+            place.as_ref(),
             access,
             places_conflict::PlaceConflictBias::Overlap,
         ) {
index 348214f97f25606c1c27a458016335fcec77d72c..b2a03147ecf803dfd5ad567bb0949556da714afe 100644 (file)
@@ -36,7 +36,7 @@
         body,
         borrow_place,
         BorrowKind::Mut { allow_two_phase_borrow: true },
-        access_place.as_place_ref(),
+        access_place.as_ref(),
         AccessDepth::Deep,
         bias,
     )
index b58cef9cce1e7779886da6a9023d81f9f95a8324..d72b0addae91500e6900d52617bb4aeacd15b83c 100644 (file)
@@ -1304,7 +1304,7 @@ fn calculate_fake_borrows<'b>(
                 prefix_cursor = base;
             }
 
-            all_fake_borrows.push(place.as_place_ref());
+            all_fake_borrows.push(place.as_ref());
         }
 
         // Deduplicate and ensure a deterministic order.
index b6dd544d395618945126a8b1f75936fdb458fbfb..c071b3101fce3f2651cb04ae147216b86043b96d 100644 (file)
@@ -171,7 +171,7 @@ pub(crate) fn drop_flag_effects_for_function_entry<'tcx, F>(
     let move_data = &ctxt.move_data;
     for arg in body.args_iter() {
         let place = mir::Place::from(arg);
-        let lookup_result = move_data.rev_lookup.find(place.as_place_ref());
+        let lookup_result = move_data.rev_lookup.find(place.as_ref());
         on_lookup_result_bits(tcx, body, move_data,
                               lookup_result,
                               |mpi| callback(mpi, DropFlagState::Present));
index ade732bbb75970ad08126d0a2434fb2e853e38a9..69bbe087921404ba5d3f4f977986050f75ffd3f7 100644 (file)
@@ -309,7 +309,7 @@ fn propagate_call_return(
         // when a call returns successfully, that means we need to set
         // the bits for that dest_place to 1 (initialized).
         on_lookup_result_bits(self.tcx, self.body, self.move_data(),
-                              self.move_data().rev_lookup.find(dest_place.as_place_ref()),
+                              self.move_data().rev_lookup.find(dest_place.as_ref()),
                               |mpi| { in_out.insert(mpi); });
     }
 }
@@ -367,7 +367,7 @@ fn propagate_call_return(
         // when a call returns successfully, that means we need to set
         // the bits for that dest_place to 0 (initialized).
         on_lookup_result_bits(self.tcx, self.body, self.move_data(),
-                              self.move_data().rev_lookup.find(dest_place.as_place_ref()),
+                              self.move_data().rev_lookup.find(dest_place.as_ref()),
                               |mpi| { in_out.remove(mpi); });
     }
 }
@@ -423,7 +423,7 @@ fn propagate_call_return(
         // when a call returns successfully, that means we need to set
         // the bits for that dest_place to 1 (initialized).
         on_lookup_result_bits(self.tcx, self.body, self.move_data(),
-                              self.move_data().rev_lookup.find(dest_place.as_place_ref()),
+                              self.move_data().rev_lookup.find(dest_place.as_ref()),
                               |mpi| { in_out.insert(mpi); });
     }
 }
index 436ac30ffb42ed9b3c131f2f443102d3c8196ca9..366b96b53b42312bd46173597a32e3605f000349 100644 (file)
@@ -274,9 +274,9 @@ fn gather_statement(&mut self, stmt: &Statement<'tcx>) {
                     // move-path for the interior so it will be separate from
                     // the exterior.
                     self.create_move_path(&place.clone().deref());
-                    self.gather_init(place.as_place_ref(), InitKind::Shallow);
+                    self.gather_init(place.as_ref(), InitKind::Shallow);
                 } else {
-                    self.gather_init(place.as_place_ref(), InitKind::Deep);
+                    self.gather_init(place.as_ref(), InitKind::Deep);
                 }
                 self.gather_rvalue(rval);
             }
@@ -286,7 +286,7 @@ fn gather_statement(&mut self, stmt: &Statement<'tcx>) {
             StatementKind::InlineAsm(ref asm) => {
                 for (output, kind) in asm.outputs.iter().zip(&asm.asm.outputs) {
                     if !kind.is_indirect {
-                        self.gather_init(output.as_place_ref(), InitKind::Deep);
+                        self.gather_init(output.as_ref(), InitKind::Deep);
                     }
                 }
                 for (_, input) in asm.inputs.iter() {
@@ -376,7 +376,7 @@ fn gather_terminator(&mut self, term: &Terminator<'tcx>) {
             TerminatorKind::DropAndReplace { ref location, ref value, .. } => {
                 self.create_move_path(location);
                 self.gather_operand(value);
-                self.gather_init(location.as_place_ref(), InitKind::Deep);
+                self.gather_init(location.as_ref(), InitKind::Deep);
             }
             TerminatorKind::Call {
                 ref func,
@@ -391,7 +391,7 @@ fn gather_terminator(&mut self, term: &Terminator<'tcx>) {
                 }
                 if let Some((ref destination, _bb)) = *destination {
                     self.create_move_path(destination);
-                    self.gather_init(destination.as_place_ref(), InitKind::NonPanicPathOnly);
+                    self.gather_init(destination.as_ref(), InitKind::NonPanicPathOnly);
                 }
             }
         }
index 887f93c64787884ccae038a4e4cafe719f65c9d6..d573423906c2ab58047d55c5bde6bfba735e7282 100644 (file)
@@ -79,7 +79,7 @@ fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, _src: MirSource<'tcx>, body: &mut Bo
         let needs_retag = |place: &Place<'tcx>| {
             // FIXME: Instead of giving up for unstable places, we should introduce
             // a temporary and retag on that.
-            is_stable(place.as_place_ref())
+            is_stable(place.as_ref())
                 && may_have_reference(place.ty(&*local_decls, tcx).ty, tcx)
         };
 
index 0748321f605938ed3830697a9b7ba1b0727a0409..0a021d9b8fa066d3b3c8f7ac44686cfba0f595ff 100644 (file)
@@ -105,7 +105,7 @@ fn find_dead_unwinds<'tcx>(
             init_data.apply_location(tcx, body, env, loc);
         }
 
-        let path = match env.move_data.rev_lookup.find(location.as_place_ref()) {
+        let path = match env.move_data.rev_lookup.find(location.as_ref()) {
             LookupResult::Exact(e) => e,
             LookupResult::Parent(..) => {
                 debug!("find_dead_unwinds: has parent; skipping");
@@ -360,7 +360,7 @@ fn collect_drop_flags(&mut self)
                 statement_index: data.statements.len()
             });
 
-            let path = self.move_data().rev_lookup.find(location.as_place_ref());
+            let path = self.move_data().rev_lookup.find(location.as_ref());
             debug!("collect_drop_flags: {:?}, place {:?} ({:?})",
                    bb, location, path);
 
@@ -399,7 +399,7 @@ fn elaborate_drops(&mut self)
             match terminator.kind {
                 TerminatorKind::Drop { ref location, target, unwind } => {
                     let init_data = self.initialization_data_at(loc);
-                    match self.move_data().rev_lookup.find(location.as_place_ref()) {
+                    match self.move_data().rev_lookup.find(location.as_ref()) {
                         LookupResult::Exact(path) => {
                             elaborate_drop(
                                 &mut Elaborator {
@@ -488,7 +488,7 @@ fn elaborate_replace(
             is_cleanup: false,
         });
 
-        match self.move_data().rev_lookup.find(location.as_place_ref()) {
+        match self.move_data().rev_lookup.find(location.as_ref()) {
             LookupResult::Exact(path) => {
                 debug!("elaborate_drop_and_replace({:?}) - tracked {:?}", terminator, path);
                 let init_data = self.initialization_data_at(loc);
@@ -558,7 +558,7 @@ fn drop_flags_for_fn_rets(&mut self) {
                 assert!(!self.patch.is_patched(bb));
 
                 let loc = Location { block: tgt, statement_index: 0 };
-                let path = self.move_data().rev_lookup.find(place.as_place_ref());
+                let path = self.move_data().rev_lookup.find(place.as_ref());
                 on_lookup_result_bits(
                     self.tcx, self.body, self.move_data(), path,
                     |child| self.set_drop_flag(loc, child, DropFlagState::Present)
@@ -632,7 +632,7 @@ fn drop_flags_for_locs(&mut self) {
                 assert!(!self.patch.is_patched(bb));
 
                 let loc = Location { block: bb, statement_index: data.statements.len() };
-                let path = self.move_data().rev_lookup.find(place.as_place_ref());
+                let path = self.move_data().rev_lookup.find(place.as_ref());
                 on_lookup_result_bits(
                     self.tcx, self.body, self.move_data(), path,
                     |child| self.set_drop_flag(loc, child, DropFlagState::Present)
index 739e2172b03bc6f6892fc06f5724495d815aa0b3..ffeaf4e19c22a76008d1a6a3a92d8b8caf68565a 100644 (file)
@@ -243,7 +243,7 @@ fn in_place(cx: &ConstCx<'_, 'tcx>, place: PlaceRef<'_, 'tcx>) -> bool {
     fn in_operand(cx: &ConstCx<'_, 'tcx>, operand: &Operand<'tcx>) -> bool {
         match *operand {
             Operand::Copy(ref place) |
-            Operand::Move(ref place) => Self::in_place(cx, place.as_place_ref()),
+            Operand::Move(ref place) => Self::in_place(cx, place.as_ref()),
 
             Operand::Constant(ref constant) => {
                 if let ConstValue::Unevaluated(def_id, _) = constant.literal.val {
@@ -272,7 +272,7 @@ fn in_rvalue_structurally(cx: &ConstCx<'_, 'tcx>, rvalue: &Rvalue<'tcx>) -> bool
             Rvalue::NullaryOp(..) => false,
 
             Rvalue::Discriminant(ref place) |
-            Rvalue::Len(ref place) => Self::in_place(cx, place.as_place_ref()),
+            Rvalue::Len(ref place) => Self::in_place(cx, place.as_ref()),
 
             Rvalue::Use(ref operand) |
             Rvalue::Repeat(ref operand, _) |
@@ -298,7 +298,7 @@ fn in_rvalue_structurally(cx: &ConstCx<'_, 'tcx>, rvalue: &Rvalue<'tcx>) -> bool
                     }
                 }
 
-                Self::in_place(cx, place.as_place_ref())
+                Self::in_place(cx, place.as_ref())
             }
 
             Rvalue::Aggregate(_, ref operands) => {
index 1fd865c42fcdb696b9c92ec793e4f3b0166cc1dd..7fe8480c819e6f690aee0fbda0a9a983c2b598fe 100644 (file)
@@ -168,7 +168,7 @@ fn each_block<'tcx, O>(
         if place == peek_arg_place {
             if let mir::Rvalue::Ref(_, mir::BorrowKind::Shared, ref peeking_at_place) = **rvalue {
                 // Okay, our search is over.
-                match move_data.rev_lookup.find(peeking_at_place.as_place_ref()) {
+                match move_data.rev_lookup.find(peeking_at_place.as_ref()) {
                     LookupResult::Exact(peek_mpi) => {
                         let bit_state = on_entry.contains(peek_mpi);
                         debug!("rustc_peek({:?} = &{:?}) bit_state: {}",
@@ -192,7 +192,7 @@ fn each_block<'tcx, O>(
             }
         }
 
-        let lhs_mpi = move_data.rev_lookup.find(place.as_place_ref());
+        let lhs_mpi = move_data.rev_lookup.find(place.as_ref());
 
         debug!("rustc_peek: computing effect on place: {:?} ({:?}) in stmt: {:?}",
                place, lhs_mpi, stmt);