Skip to content

Commit 2eb5457

Browse files
committed
Rename Place::local to Place::local_or_deref_local
1 parent 4dbc7f9 commit 2eb5457

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/librustc/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ impl<'tcx> Place<'tcx> {
20402040
/// a single deref of a local.
20412041
//
20422042
// FIXME: can we safely swap the semantics of `fn base_local` below in here instead?
2043-
pub fn local(&self) -> Option<Local> {
2043+
pub fn local_or_deref_local(&self) -> Option<Local> {
20442044
match self {
20452045
Place::Base(PlaceBase::Local(local)) |
20462046
Place::Projection(box Projection {

src/librustc_mir/borrow_check/conflict_errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
16161616
);
16171617

16181618
// Find the local from the operand.
1619-
let assigned_from_local = match assigned_from.local() {
1619+
let assigned_from_local = match assigned_from.local_or_deref_local() {
16201620
Some(local) => local,
16211621
None => continue,
16221622
};
@@ -1672,7 +1672,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
16721672
);
16731673

16741674
// Find the local from the rvalue.
1675-
let assigned_from_local = match assigned_from.local() {
1675+
let assigned_from_local = match assigned_from.local_or_deref_local() {
16761676
Some(local) => local,
16771677
None => continue,
16781678
};
@@ -1735,7 +1735,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
17351735
assigned_from,
17361736
);
17371737

1738-
if let Some(assigned_from_local) = assigned_from.local() {
1738+
if let Some(assigned_from_local) = assigned_from.local_or_deref_local() {
17391739
debug!(
17401740
"annotate_argument_and_return_for_borrow: assigned_from_local={:?}",
17411741
assigned_from_local,

src/librustc_mir/borrow_check/error_reporting.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
3737
diag: &mut DiagnosticBuilder<'_>,
3838
) {
3939
debug!("add_moved_or_invoked_closure_note: location={:?} place={:?}", location, place);
40-
let mut target = place.local();
40+
let mut target = place.local_or_deref_local();
4141
for stmt in &self.mir[location.block].statements[location.statement_index..] {
4242
debug!("add_moved_or_invoked_closure_note: stmt={:?} target={:?}", stmt, target);
4343
if let StatementKind::Assign(into, box Rvalue::Use(from)) = &stmt.kind {
4444
debug!("add_fnonce_closure_note: into={:?} from={:?}", into, from);
4545
match from {
4646
Operand::Copy(ref place) |
47-
Operand::Move(ref place) if target == place.local() =>
48-
target = into.local(),
47+
Operand::Move(ref place) if target == place.local_or_deref_local() =>
48+
target = into.local_or_deref_local(),
4949
_ => {},
5050
}
5151
}
@@ -69,8 +69,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
6969
if self.infcx.tcx.parent(id) == self.infcx.tcx.lang_items().fn_once_trait() {
7070
let closure = match args.first() {
7171
Some(Operand::Copy(ref place)) |
72-
Some(Operand::Move(ref place)) if target == place.local() =>
73-
place.local().unwrap(),
72+
Some(Operand::Move(ref place)) if target == place.local_or_deref_local() =>
73+
place.local_or_deref_local().unwrap(),
7474
_ => return,
7575
};
7676

src/librustc_mir/dataflow/impls/storage_liveness.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ impl<'a, 'tcx> BitDenotation<'tcx> for MaybeStorageLive<'a, 'tcx> {
4646
sets: &mut BlockSets<'_, Local>,
4747
loc: Location) {
4848
match &self.mir[loc.block].terminator().kind {
49-
TerminatorKind::Drop { location, .. } => if let Some(l) = location.local() {
50-
sets.kill(l);
49+
TerminatorKind::Drop { location, .. } => {
50+
if let Some(l) = location.local_or_deref_local() {
51+
sets.kill(l);
52+
}
5153
}
5254
_ => (),
5355
}

0 commit comments

Comments
 (0)