Skip to content

Commit 39e126c

Browse files
committed
Refactoring alpha-rename place (BorrowData field) to borrowed_place.
1 parent e123117 commit 39e126c

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
9696
Some(name) => format!("`{}`", name),
9797
None => "value".to_owned(),
9898
};
99-
let borrow_msg = match self.describe_place(&borrow.place) {
99+
let borrow_msg = match self.describe_place(&borrow.borrowed_place) {
100100
Some(name) => format!("`{}`", name),
101101
None => "value".to_owned(),
102102
};
@@ -124,7 +124,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
124124
span,
125125
&self.describe_place(place).unwrap_or("_".to_owned()),
126126
self.retrieve_borrow_span(borrow),
127-
&self.describe_place(&borrow.place).unwrap_or("_".to_owned()),
127+
&self.describe_place(&borrow.borrowed_place).unwrap_or("_".to_owned()),
128128
Origin::Mir,
129129
);
130130

@@ -328,7 +328,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
328328
) {
329329
let end_span = borrows.opt_region_end_span(&borrow.region);
330330
let scope_tree = borrows.scope_tree();
331-
let root_place = self.prefixes(&borrow.place, PrefixSet::All).last().unwrap();
331+
let root_place = self.prefixes(&borrow.borrowed_place, PrefixSet::All).last().unwrap();
332332

333333
match root_place {
334334
&Place::Local(local) => {
@@ -357,7 +357,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
357357
_ => drop_span,
358358
};
359359

360-
match (borrow.region, &self.describe_place(&borrow.place)) {
360+
match (borrow.region, &self.describe_place(&borrow.borrowed_place)) {
361361
(RegionKind::ReScope(_), Some(name)) => {
362362
self.report_scoped_local_value_does_not_live_long_enough(
363363
name, &scope_tree, &borrow, drop_span, borrow_span, proper_span, end_span);

src/librustc_mir/borrow_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
917917
flow_state: &Flows<'cx, 'gcx, 'tcx>)
918918
{
919919
debug!("check_for_invalidation_at_exit({:?})", borrow);
920-
let place = &borrow.place;
920+
let place = &borrow.borrowed_place;
921921
let root_place = self.prefixes(place, PrefixSet::All).last().unwrap();
922922

923923
// FIXME(nll-rfc#40): do more precise destructor tracking here. For now
@@ -1792,7 +1792,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
17921792
for i in flow_state.borrows.elems_incoming() {
17931793
let borrowed = &data[i];
17941794

1795-
if self.places_conflict(&borrowed.place, place, access) {
1795+
if self.places_conflict(&borrowed.borrowed_place, place, access) {
17961796
let ctrl = op(self, i, borrowed);
17971797
if ctrl == Control::Break { return; }
17981798
}

src/librustc_mir/dataflow/impls/borrows.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ pub struct Borrows<'a, 'gcx: 'tcx, 'tcx: 'a> {
4949
}
5050

5151
// temporarily allow some dead fields: `kind` and `region` will be
52-
// needed by borrowck; `place` will probably be a MovePathIndex when
52+
// needed by borrowck; `borrowed_place` will probably be a MovePathIndex when
5353
// that is extended to include borrowed data paths.
5454
#[allow(dead_code)]
5555
#[derive(Debug)]
5656
pub struct BorrowData<'tcx> {
5757
pub(crate) location: Location,
5858
pub(crate) kind: mir::BorrowKind,
5959
pub(crate) region: Region<'tcx>,
60-
pub(crate) place: mir::Place<'tcx>,
60+
pub(crate) borrowed_place: mir::Place<'tcx>,
6161
}
6262

6363
impl<'tcx> fmt::Display for BorrowData<'tcx> {
@@ -69,7 +69,7 @@ impl<'tcx> fmt::Display for BorrowData<'tcx> {
6969
};
7070
let region = format!("{}", self.region);
7171
let region = if region.len() > 0 { format!("{} ", region) } else { region };
72-
write!(w, "&{}{}{:?}", region, kind, self.place)
72+
write!(w, "&{}{}{:?}", region, kind, self.borrowed_place)
7373
}
7474
}
7575

@@ -131,7 +131,7 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
131131
if is_unsafe_place(self.tcx, self.mir, place) { return; }
132132

133133
let borrow = BorrowData {
134-
location: location, kind: kind, region: region, place: place.clone(),
134+
location, kind, region, borrowed_place: place.clone(),
135135
};
136136
let idx = self.idx_vec.push(borrow);
137137
self.location_map.insert(location, idx);

0 commit comments

Comments
 (0)