Skip to content

Commit e9e9abd

Browse files
committed
Refactoring alpha-rename place (BorrowData field) to borrowed_place.
1 parent a37950d commit e9e9abd

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/librustc_mir/borrow_check/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx
537537
for i in borrows {
538538
let borrow = &data[i];
539539

540-
if self.place_is_invalidated_at_exit(&borrow.place) {
540+
if self.place_is_invalidated_at_exit(&borrow.borrowed_place) {
541541
debug!("borrow conflicts at exit {:?}", borrow);
542542
let borrow_span = self.mir.source_info(borrow.location).span;
543543
// FIXME: should be talking about the region lifetime instead
@@ -546,7 +546,7 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx
546546

547547
self.report_borrowed_value_does_not_live_long_enough(
548548
ContextKind::StorageDead.new(loc),
549-
(&borrow.place, borrow_span),
549+
(&borrow.borrowed_place, borrow_span),
550550
end_span,
551551
)
552552
}
@@ -1506,7 +1506,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
15061506
// FIXME: Differs from AST-borrowck; includes drive-by fix
15071507
// to #38899. Will probably need back-compat mode flag.
15081508
for accessed_prefix in self.prefixes(place, PrefixSet::All) {
1509-
if *accessed_prefix == borrowed.place {
1509+
if *accessed_prefix == borrowed.borrowed_place {
15101510
// FIXME: pass in enum describing case we are in?
15111511
let ctrl = op(self, i, borrowed, accessed_prefix);
15121512
if ctrl == Control::Break {
@@ -1516,7 +1516,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
15161516
}
15171517

15181518
// Is `place` a prefix (modulo access type) of the
1519-
// `borrowed.place`? If so, that's relevant.
1519+
// `borrowed.borrowed_place`? If so, that's relevant.
15201520

15211521
let prefix_kind = match access {
15221522
Shallow(Some(ArtificialField::Discriminant)) |
@@ -1533,7 +1533,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
15331533
Deep => PrefixSet::Supporting,
15341534
};
15351535

1536-
for borrowed_prefix in self.prefixes(&borrowed.place, prefix_kind) {
1536+
for borrowed_prefix in self.prefixes(&borrowed.borrowed_place, prefix_kind) {
15371537
if borrowed_prefix == place {
15381538
// FIXME: pass in enum describing case we are in?
15391539
let ctrl = op(self, i, borrowed, borrowed_prefix);
@@ -1801,7 +1801,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
18011801
Some(name) => format!("`{}`", name),
18021802
None => "value".to_owned(),
18031803
};
1804-
let borrow_msg = match self.describe_place(&borrow.place) {
1804+
let borrow_msg = match self.describe_place(&borrow.borrowed_place) {
18051805
Some(name) => format!("`{}`", name),
18061806
None => "value".to_owned(),
18071807
};
@@ -1829,7 +1829,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
18291829
span,
18301830
&self.describe_place(place).unwrap_or("_".to_owned()),
18311831
self.retrieve_borrow_span(borrow),
1832-
&self.describe_place(&borrow.place).unwrap_or("_".to_owned()),
1832+
&self.describe_place(&borrow.borrowed_place).unwrap_or("_".to_owned()),
18331833
Origin::Mir,
18341834
);
18351835

@@ -1915,7 +1915,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
19151915
use self::prefixes::IsPrefixOf;
19161916

19171917
assert!(common_prefix.is_prefix_of(place));
1918-
assert!(common_prefix.is_prefix_of(&issued_borrow.place));
1918+
assert!(common_prefix.is_prefix_of(&issued_borrow.borrowed_place));
19191919

19201920
let issued_span = self.retrieve_borrow_span(issued_borrow);
19211921

src/librustc_mir/dataflow/impls/borrows.rs

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

4444
// temporarily allow some dead fields: `kind` and `region` will be
45-
// needed by borrowck; `place` will probably be a MovePathIndex when
45+
// needed by borrowck; `borrowed_place` will probably be a MovePathIndex when
4646
// that is extended to include borrowed data paths.
4747
#[allow(dead_code)]
4848
#[derive(Debug)]
4949
pub struct BorrowData<'tcx> {
5050
pub(crate) location: Location,
5151
pub(crate) kind: mir::BorrowKind,
5252
pub(crate) region: Region<'tcx>,
53-
pub(crate) place: mir::Place<'tcx>,
53+
pub(crate) borrowed_place: mir::Place<'tcx>,
5454
}
5555

5656
impl<'tcx> fmt::Display for BorrowData<'tcx> {
@@ -62,7 +62,7 @@ impl<'tcx> fmt::Display for BorrowData<'tcx> {
6262
};
6363
let region = format!("{}", self.region);
6464
let region = if region.len() > 0 { format!("{} ", region) } else { region };
65-
write!(w, "&{}{}{:?}", region, kind, self.place)
65+
write!(w, "&{}{}{:?}", region, kind, self.borrowed_place)
6666
}
6767
}
6868

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

107107
let borrow = BorrowData {
108-
location: location, kind: kind, region: region, place: place.clone(),
108+
location, kind, region, borrowed_place: place.clone(),
109109
};
110110
let idx = self.idx_vec.push(borrow);
111111
self.location_map.insert(location, idx);

0 commit comments

Comments
 (0)