Skip to content

Commit 28db2c9

Browse files
committed
Make all projection base names be proj_base
1 parent 6ffc20f commit 28db2c9

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/librustc_mir/borrow_check/conflict_errors.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -615,13 +615,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
615615
} = first_borrowed_place;
616616

617617
for (i, elem) in projection.iter().enumerate().rev() {
618-
let base_proj = &projection[..i];
618+
let proj_base = &projection[..i];
619619

620620
match elem {
621-
ProjectionElem::Field(field, _) if union_ty(base, base_proj).is_some() => {
621+
ProjectionElem::Field(field, _) if union_ty(base, proj_base).is_some() => {
622622
return Some((PlaceRef {
623623
base: base,
624-
projection: base_proj,
624+
projection: proj_base,
625625
}, field));
626626
},
627627
_ => {},
@@ -1520,26 +1520,26 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15201520
[] => {
15211521
StorageDeadOrDrop::LocalStorageDead
15221522
}
1523-
[base @ .., elem] => {
1523+
[proj_base @ .., elem] => {
15241524
// FIXME(spastorino) make this iterate
15251525
let base_access = self.classify_drop_access_kind(PlaceRef {
15261526
base: place.base,
1527-
projection: base,
1527+
projection: proj_base,
15281528
});
15291529
match elem {
15301530
ProjectionElem::Deref => match base_access {
15311531
StorageDeadOrDrop::LocalStorageDead
15321532
| StorageDeadOrDrop::BoxedStorageDead => {
15331533
assert!(
1534-
Place::ty_from(&place.base, base, self.body, tcx).ty.is_box(),
1534+
Place::ty_from(&place.base, proj_base, self.body, tcx).ty.is_box(),
15351535
"Drop of value behind a reference or raw pointer"
15361536
);
15371537
StorageDeadOrDrop::BoxedStorageDead
15381538
}
15391539
StorageDeadOrDrop::Destructor(_) => base_access,
15401540
},
15411541
ProjectionElem::Field(..) | ProjectionElem::Downcast(..) => {
1542-
let base_ty = Place::ty_from(&place.base, base, self.body, tcx).ty;
1542+
let base_ty = Place::ty_from(&place.base, proj_base, self.body, tcx).ty;
15431543
match base_ty.sty {
15441544
ty::Adt(def, _) if def.has_dtor(tcx) => {
15451545
// Report the outermost adt with a destructor

src/librustc_mir/borrow_check/mutability_errors.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
8282

8383
PlaceRef {
8484
base: _,
85-
projection: [base @ .., ProjectionElem::Deref],
85+
projection: [proj_base @ .., ProjectionElem::Deref],
8686
} => {
8787
if the_place_err.base == &PlaceBase::Local(Local::new(1)) &&
88-
base.is_empty() &&
88+
proj_base.is_empty() &&
8989
!self.upvars.is_empty() {
9090
item_msg = format!("`{}`", access_place_desc.unwrap());
9191
debug_assert!(self.body.local_decls[Local::new(1)].ty.is_region_ptr());
@@ -106,7 +106,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
106106
", as `Fn` closures cannot mutate their captured variables".to_string()
107107
}
108108
} else if {
109-
if let (PlaceBase::Local(local), []) = (&the_place_err.base, base) {
109+
if let (PlaceBase::Local(local), []) = (&the_place_err.base, proj_base) {
110110
self.body.local_decls[*local].is_ref_for_guard()
111111
} else {
112112
false
@@ -117,7 +117,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
117117
} else {
118118
let source = self.borrowed_content_source(PlaceRef {
119119
base: the_place_err.base,
120-
projection: base,
120+
projection: proj_base,
121121
});
122122
let pointer_type = source.describe_for_immutable_place();
123123
opt_source = Some(source);
@@ -240,7 +240,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
240240
// after the field access).
241241
PlaceRef {
242242
base,
243-
projection: [base_proj @ ..,
243+
projection: [proj_base @ ..,
244244
ProjectionElem::Deref,
245245
ProjectionElem::Field(field, _),
246246
ProjectionElem::Deref,
@@ -250,7 +250,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
250250

251251
if let Some((span, message)) = annotate_struct_field(
252252
self.infcx.tcx,
253-
Place::ty_from(base, base_proj, self.body, self.infcx.tcx).ty,
253+
Place::ty_from(base, proj_base, self.body, self.infcx.tcx).ty,
254254
field,
255255
) {
256256
err.span_suggestion(

src/librustc_mir/build/expr/as_rvalue.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -514,19 +514,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
514514
}
515515
Place {
516516
ref base,
517-
projection: box [ref base_proj @ .., ProjectionElem::Field(upvar_index, _)],
517+
projection: box [ref proj_base @ .., ProjectionElem::Field(upvar_index, _)],
518518
}
519519
| Place {
520520
ref base,
521521
projection: box [
522-
ref base_proj @ ..,
522+
ref proj_base @ ..,
523523
ProjectionElem::Field(upvar_index, _),
524524
ProjectionElem::Deref
525525
],
526526
} => {
527527
let place = PlaceRef {
528528
base,
529-
projection: base_proj,
529+
projection: proj_base,
530530
};
531531

532532
// Not projected from the implicit `self` in a closure.

0 commit comments

Comments
 (0)