diff options
| -rw-r--r-- | src/librustc_mir/borrow_check/conflict_errors.rs | 14 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/mutability_errors.rs | 12 | ||||
| -rw-r--r-- | src/librustc_mir/build/expr/as_rvalue.rs | 6 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/librustc_mir/borrow_check/conflict_errors.rs b/src/librustc_mir/borrow_check/conflict_errors.rs index c901eb29054..4b4516d6bf2 100644 --- a/src/librustc_mir/borrow_check/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/conflict_errors.rs @@ -615,13 +615,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } = first_borrowed_place; for (i, elem) in projection.iter().enumerate().rev() { - let base_proj = &projection[..i]; + let proj_base = &projection[..i]; match elem { - ProjectionElem::Field(field, _) if union_ty(base, base_proj).is_some() => { + ProjectionElem::Field(field, _) if union_ty(base, proj_base).is_some() => { return Some((PlaceRef { base: base, - projection: base_proj, + projection: proj_base, }, field)); }, _ => {}, @@ -1520,18 +1520,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { [] => { StorageDeadOrDrop::LocalStorageDead } - [base @ .., elem] => { + [proj_base @ .., elem] => { // FIXME(spastorino) make this iterate let base_access = self.classify_drop_access_kind(PlaceRef { base: place.base, - projection: base, + projection: proj_base, }); match elem { ProjectionElem::Deref => match base_access { StorageDeadOrDrop::LocalStorageDead | StorageDeadOrDrop::BoxedStorageDead => { assert!( - Place::ty_from(&place.base, base, self.body, tcx).ty.is_box(), + Place::ty_from(&place.base, proj_base, self.body, tcx).ty.is_box(), "Drop of value behind a reference or raw pointer" ); StorageDeadOrDrop::BoxedStorageDead @@ -1539,7 +1539,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { StorageDeadOrDrop::Destructor(_) => base_access, }, ProjectionElem::Field(..) | ProjectionElem::Downcast(..) => { - let base_ty = Place::ty_from(&place.base, base, self.body, tcx).ty; + let base_ty = Place::ty_from(&place.base, proj_base, self.body, tcx).ty; match base_ty.sty { ty::Adt(def, _) if def.has_dtor(tcx) => { // Report the outermost adt with a destructor diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 9b9dfc30233..14b76d97b3e 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -82,10 +82,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { PlaceRef { base: _, - projection: [base @ .., ProjectionElem::Deref], + projection: [proj_base @ .., ProjectionElem::Deref], } => { if the_place_err.base == &PlaceBase::Local(Local::new(1)) && - base.is_empty() && + proj_base.is_empty() && !self.upvars.is_empty() { item_msg = format!("`{}`", access_place_desc.unwrap()); debug_assert!(self.body.local_decls[Local::new(1)].ty.is_region_ptr()); @@ -106,7 +106,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { ", as `Fn` closures cannot mutate their captured variables".to_string() } } else if { - if let (PlaceBase::Local(local), []) = (&the_place_err.base, base) { + if let (PlaceBase::Local(local), []) = (&the_place_err.base, proj_base) { self.body.local_decls[*local].is_ref_for_guard() } else { false @@ -117,7 +117,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { } else { let source = self.borrowed_content_source(PlaceRef { base: the_place_err.base, - projection: base, + projection: proj_base, }); let pointer_type = source.describe_for_immutable_place(); opt_source = Some(source); @@ -240,7 +240,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { // after the field access). PlaceRef { base, - projection: [base_proj @ .., + projection: [proj_base @ .., ProjectionElem::Deref, ProjectionElem::Field(field, _), ProjectionElem::Deref, @@ -250,7 +250,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { if let Some((span, message)) = annotate_struct_field( self.infcx.tcx, - Place::ty_from(base, base_proj, self.body, self.infcx.tcx).ty, + Place::ty_from(base, proj_base, self.body, self.infcx.tcx).ty, field, ) { err.span_suggestion( diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index 6692984524f..7dfe98cbebf 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -514,19 +514,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } Place { ref base, - projection: box [ref base_proj @ .., ProjectionElem::Field(upvar_index, _)], + projection: box [ref proj_base @ .., ProjectionElem::Field(upvar_index, _)], } | Place { ref base, projection: box [ - ref base_proj @ .., + ref proj_base @ .., ProjectionElem::Field(upvar_index, _), ProjectionElem::Deref ], } => { let place = PlaceRef { base, - projection: base_proj, + projection: proj_base, }; // Not projected from the implicit `self` in a closure. |
