Skip to content

Commit b11cd0b

Browse files
committed
PlaceRef<'a, 'tcx> -> PlaceRef<'tcx>
1 parent 2cb2559 commit b11cd0b

File tree

15 files changed

+46
-50
lines changed

15 files changed

+46
-50
lines changed

src/librustc/mir/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1827,9 +1827,9 @@ rustc_index::newtype_index! {
18271827
}
18281828

18291829
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
1830-
pub struct PlaceRef<'a, 'tcx> {
1830+
pub struct PlaceRef<'tcx> {
18311831
pub local: Local,
1832-
pub projection: &'a [PlaceElem<'tcx>],
1832+
pub projection: &'tcx [PlaceElem<'tcx>],
18331833
}
18341834

18351835
impl<'tcx> Place<'tcx> {
@@ -1864,7 +1864,7 @@ impl<'tcx> Place<'tcx> {
18641864
self.as_ref().as_local()
18651865
}
18661866

1867-
pub fn as_ref(&self) -> PlaceRef<'tcx, 'tcx> {
1867+
pub fn as_ref(&self) -> PlaceRef<'tcx> {
18681868
PlaceRef { local: self.local, projection: &self.projection }
18691869
}
18701870
}
@@ -1875,7 +1875,7 @@ impl From<Local> for Place<'_> {
18751875
}
18761876
}
18771877

1878-
impl<'a, 'tcx> PlaceRef<'a, 'tcx> {
1878+
impl<'tcx> PlaceRef<'tcx> {
18791879
/// Finds the innermost `Local` from this `Place`, *if* it is either a local itself or
18801880
/// a single deref of a local.
18811881
//

src/librustc_codegen_ssa/mir/analyze.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
9797

9898
fn process_place(
9999
&mut self,
100-
place_ref: &mir::PlaceRef<'tcx, 'tcx>,
100+
place_ref: &mir::PlaceRef<'tcx>,
101101
context: PlaceContext,
102102
location: Location,
103103
) {

src/librustc_codegen_ssa/mir/operand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
364364
fn maybe_codegen_consume_direct(
365365
&mut self,
366366
bx: &mut Bx,
367-
place_ref: mir::PlaceRef<'tcx, 'tcx>,
367+
place_ref: mir::PlaceRef<'tcx>,
368368
) -> Option<OperandRef<'tcx, Bx::Value>> {
369369
debug!("maybe_codegen_consume_direct(place_ref={:?})", place_ref);
370370

@@ -408,7 +408,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
408408
pub fn codegen_consume(
409409
&mut self,
410410
bx: &mut Bx,
411-
place_ref: mir::PlaceRef<'tcx, 'tcx>,
411+
place_ref: mir::PlaceRef<'tcx>,
412412
) -> OperandRef<'tcx, Bx::Value> {
413413
debug!("codegen_consume(place_ref={:?})", place_ref);
414414

src/librustc_codegen_ssa/mir/place.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
408408
pub fn codegen_place(
409409
&mut self,
410410
bx: &mut Bx,
411-
place_ref: mir::PlaceRef<'tcx, 'tcx>,
411+
place_ref: mir::PlaceRef<'tcx>,
412412
) -> PlaceRef<'tcx, Bx::Value> {
413413
debug!("codegen_place(place_ref={:?})", place_ref);
414414
let cx = self.cx;
@@ -497,7 +497,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
497497
result
498498
}
499499

500-
pub fn monomorphized_place_ty(&self, place_ref: mir::PlaceRef<'tcx, 'tcx>) -> Ty<'tcx> {
500+
pub fn monomorphized_place_ty(&self, place_ref: mir::PlaceRef<'tcx>) -> Ty<'tcx> {
501501
let tcx = self.cx.tcx();
502502
let place_ty = mir::Place::ty_from(place_ref.local, place_ref.projection, *self.mir, tcx);
503503
self.monomorphize(&place_ty.ty)

src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
5151
&mut self,
5252
location: Location,
5353
desired_action: InitializationRequiringAction,
54-
(moved_place, used_place, span): (PlaceRef<'tcx, 'tcx>, PlaceRef<'tcx, 'tcx>, Span),
54+
(moved_place, used_place, span): (PlaceRef<'tcx>, PlaceRef<'tcx>, Span),
5555
mpi: MovePathIndex,
5656
) {
5757
debug!(
@@ -1521,7 +1521,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15211521
err.buffer(&mut self.errors_buffer);
15221522
}
15231523

1524-
fn classify_drop_access_kind(&self, place: PlaceRef<'tcx, 'tcx>) -> StorageDeadOrDrop<'tcx> {
1524+
fn classify_drop_access_kind(&self, place: PlaceRef<'tcx>) -> StorageDeadOrDrop<'tcx> {
15251525
let tcx = self.infcx.tcx;
15261526
match place.projection {
15271527
[] => StorageDeadOrDrop::LocalStorageDead,

src/librustc_mir/borrow_check/diagnostics/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
5151
pub(super) fn add_moved_or_invoked_closure_note(
5252
&self,
5353
location: Location,
54-
place: PlaceRef<'tcx, 'tcx>,
54+
place: PlaceRef<'tcx>,
5555
diag: &mut DiagnosticBuilder<'_>,
5656
) {
5757
debug!("add_moved_or_invoked_closure_note: location={:?} place={:?}", location, place);
@@ -139,7 +139,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
139139

140140
/// End-user visible description of `place` if one can be found. If the
141141
/// place is a temporary for instance, None will be returned.
142-
pub(super) fn describe_place(&self, place_ref: PlaceRef<'tcx, 'tcx>) -> Option<String> {
142+
pub(super) fn describe_place(&self, place_ref: PlaceRef<'tcx>) -> Option<String> {
143143
self.describe_place_with_options(place_ref, IncludingDowncast(false))
144144
}
145145

@@ -149,7 +149,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
149149
/// `Downcast` and `IncludingDowncast` is true
150150
pub(super) fn describe_place_with_options(
151151
&self,
152-
place: PlaceRef<'tcx, 'tcx>,
152+
place: PlaceRef<'tcx>,
153153
including_downcast: IncludingDowncast,
154154
) -> Option<String> {
155155
let mut buf = String::new();
@@ -162,7 +162,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
162162
/// Appends end-user visible description of `place` to `buf`.
163163
fn append_place_to_string(
164164
&self,
165-
place: PlaceRef<'tcx, 'tcx>,
165+
place: PlaceRef<'tcx>,
166166
buf: &mut String,
167167
mut autoderef: bool,
168168
including_downcast: &IncludingDowncast,
@@ -303,7 +303,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
303303
}
304304

305305
/// End-user visible description of the `field`nth field of `base`
306-
fn describe_field(&self, place: PlaceRef<'tcx, 'tcx>, field: Field) -> String {
306+
fn describe_field(&self, place: PlaceRef<'tcx>, field: Field) -> String {
307307
// FIXME Place2 Make this work iteratively
308308
match place {
309309
PlaceRef { local, projection: [] } => {
@@ -399,7 +399,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
399399

400400
pub(super) fn borrowed_content_source(
401401
&self,
402-
deref_base: PlaceRef<'tcx, 'tcx>,
402+
deref_base: PlaceRef<'tcx>,
403403
) -> BorrowedContentSource<'tcx> {
404404
let tcx = self.infcx.tcx;
405405

@@ -694,7 +694,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
694694
/// Finds the spans associated to a move or copy of move_place at location.
695695
pub(super) fn move_spans(
696696
&self,
697-
moved_place: PlaceRef<'tcx, 'tcx>, // Could also be an upvar.
697+
moved_place: PlaceRef<'tcx>, // Could also be an upvar.
698698
location: Location,
699699
) -> UseSpans {
700700
use self::UseSpans::*;
@@ -782,7 +782,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
782782
fn closure_span(
783783
&self,
784784
def_id: DefId,
785-
target_place: PlaceRef<'tcx, 'tcx>,
785+
target_place: PlaceRef<'tcx>,
786786
places: &Vec<Operand<'tcx>>,
787787
) -> Option<(Span, Option<GeneratorKind>, Span)> {
788788
debug!(

src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
2323
&mut self,
2424
access_place: &Place<'tcx>,
2525
span: Span,
26-
the_place_err: PlaceRef<'tcx, 'tcx>,
26+
the_place_err: PlaceRef<'tcx>,
2727
error_access: AccessKind,
2828
location: Location,
2929
) {

src/librustc_mir/borrow_check/mod.rs

+11-15
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,10 @@ crate struct MirBorrowckCtxt<'cx, 'tcx> {
468468
/// `BTreeMap` is used to preserve the order of insertions when iterating. This is necessary
469469
/// when errors in the map are being re-added to the error buffer so that errors with the
470470
/// same primary span come out in a consistent order.
471-
move_error_reported:
472-
BTreeMap<Vec<MoveOutIndex>, (PlaceRef<'tcx, 'tcx>, DiagnosticBuilder<'cx>)>,
471+
move_error_reported: BTreeMap<Vec<MoveOutIndex>, (PlaceRef<'tcx>, DiagnosticBuilder<'cx>)>,
473472
/// This field keeps track of errors reported in the checking of uninitialized variables,
474473
/// so that we don't report seemingly duplicate errors.
475-
uninitialized_error_reported: FxHashSet<PlaceRef<'tcx, 'tcx>>,
474+
uninitialized_error_reported: FxHashSet<PlaceRef<'tcx>>,
476475
/// Errors to be reported buffer
477476
errors_buffer: Vec<Diagnostic>,
478477
/// This field keeps track of all the local variables that are declared mut and are mutated.
@@ -1528,7 +1527,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15281527
&mut self,
15291528
location: Location,
15301529
desired_action: InitializationRequiringAction,
1531-
place_span: (PlaceRef<'tcx, 'tcx>, Span),
1530+
place_span: (PlaceRef<'tcx>, Span),
15321531
flow_state: &Flows<'cx, 'tcx>,
15331532
) {
15341533
let maybe_uninits = &flow_state.uninits;
@@ -1594,7 +1593,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15941593
&mut self,
15951594
location: Location,
15961595
desired_action: InitializationRequiringAction,
1597-
place_span: (PlaceRef<'tcx, 'tcx>, Span),
1596+
place_span: (PlaceRef<'tcx>, Span),
15981597
maybe_uninits: &BitSet<MovePathIndex>,
15991598
from: u32,
16001599
to: u32,
@@ -1633,7 +1632,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16331632
&mut self,
16341633
location: Location,
16351634
desired_action: InitializationRequiringAction,
1636-
place_span: (PlaceRef<'tcx, 'tcx>, Span),
1635+
place_span: (PlaceRef<'tcx>, Span),
16371636
flow_state: &Flows<'cx, 'tcx>,
16381637
) {
16391638
let maybe_uninits = &flow_state.uninits;
@@ -1711,10 +1710,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
17111710
/// An Err result includes a tag indicated why the search failed.
17121711
/// Currently this can only occur if the place is built off of a
17131712
/// static variable, as we do not track those in the MoveData.
1714-
fn move_path_closest_to(
1715-
&mut self,
1716-
place: PlaceRef<'tcx, 'tcx>,
1717-
) -> (PlaceRef<'tcx, 'tcx>, MovePathIndex) {
1713+
fn move_path_closest_to(&mut self, place: PlaceRef<'tcx>) -> (PlaceRef<'tcx>, MovePathIndex) {
17181714
match self.move_data.rev_lookup.find(place) {
17191715
LookupResult::Parent(Some(mpi)) | LookupResult::Exact(mpi) => {
17201716
(self.move_data.move_paths[mpi].place.as_ref(), mpi)
@@ -1723,7 +1719,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
17231719
}
17241720
}
17251721

1726-
fn move_path_for_place(&mut self, place: PlaceRef<'tcx, 'tcx>) -> Option<MovePathIndex> {
1722+
fn move_path_for_place(&mut self, place: PlaceRef<'tcx>) -> Option<MovePathIndex> {
17271723
// If returns None, then there is no move path corresponding
17281724
// to a direct owner of `place` (which means there is nothing
17291725
// that borrowck tracks for its analysis).
@@ -1818,7 +1814,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
18181814
fn check_parent_of_field<'cx, 'tcx>(
18191815
this: &mut MirBorrowckCtxt<'cx, 'tcx>,
18201816
location: Location,
1821-
base: PlaceRef<'tcx, 'tcx>,
1817+
base: PlaceRef<'tcx>,
18221818
span: Span,
18231819
flow_state: &Flows<'cx, 'tcx>,
18241820
) {
@@ -2067,9 +2063,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20672063
/// Returns the root place if the place passed in is a projection.
20682064
fn is_mutable(
20692065
&self,
2070-
place: PlaceRef<'tcx, 'tcx>,
2066+
place: PlaceRef<'tcx>,
20712067
is_local_mutation_allowed: LocalMutationIsAllowed,
2072-
) -> Result<RootPlace<'tcx>, PlaceRef<'tcx, 'tcx>> {
2068+
) -> Result<RootPlace<'tcx>, PlaceRef<'tcx>> {
20732069
match place {
20742070
PlaceRef { local, projection: [] } => {
20752071
let local = &self.body.local_decls[local];
@@ -2220,7 +2216,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22202216
/// then returns the index of the field being projected. Note that this closure will always
22212217
/// be `self` in the current MIR, because that is the only time we directly access the fields
22222218
/// of a closure type.
2223-
pub fn is_upvar_field_projection(&self, place_ref: PlaceRef<'tcx, 'tcx>) -> Option<Field> {
2219+
pub fn is_upvar_field_projection(&self, place_ref: PlaceRef<'tcx>) -> Option<Field> {
22242220
let mut place_projection = place_ref.projection;
22252221
let mut by_ref = false;
22262222

src/librustc_mir/borrow_check/places_conflict.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(super) fn borrow_conflicts_with_place<'tcx>(
4848
body: &Body<'tcx>,
4949
borrow_place: &Place<'tcx>,
5050
borrow_kind: BorrowKind,
51-
access_place: PlaceRef<'tcx, 'tcx>,
51+
access_place: PlaceRef<'tcx>,
5252
access: AccessDepth,
5353
bias: PlaceConflictBias,
5454
) -> bool {
@@ -73,7 +73,7 @@ fn place_components_conflict<'tcx>(
7373
body: &Body<'tcx>,
7474
borrow_place: &Place<'tcx>,
7575
borrow_kind: BorrowKind,
76-
access_place: PlaceRef<'tcx, 'tcx>,
76+
access_place: PlaceRef<'tcx>,
7777
access: AccessDepth,
7878
bias: PlaceConflictBias,
7979
) -> bool {

src/librustc_mir/borrow_check/prefixes.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use rustc::ty::{self, TyCtxt};
1414
use rustc_hir as hir;
1515

1616
pub trait IsPrefixOf<'tcx> {
17-
fn is_prefix_of(&self, other: PlaceRef<'tcx, 'tcx>) -> bool;
17+
fn is_prefix_of(&self, other: PlaceRef<'tcx>) -> bool;
1818
}
1919

20-
impl<'tcx> IsPrefixOf<'tcx> for PlaceRef<'tcx, 'tcx> {
21-
fn is_prefix_of(&self, other: PlaceRef<'tcx, 'tcx>) -> bool {
20+
impl<'tcx> IsPrefixOf<'tcx> for PlaceRef<'tcx> {
21+
fn is_prefix_of(&self, other: PlaceRef<'tcx>) -> bool {
2222
self.local == other.local
2323
&& self.projection.len() <= other.projection.len()
2424
&& self.projection == &other.projection[..self.projection.len()]
@@ -29,7 +29,7 @@ pub(super) struct Prefixes<'cx, 'tcx> {
2929
body: ReadOnlyBodyAndCache<'cx, 'tcx>,
3030
tcx: TyCtxt<'tcx>,
3131
kind: PrefixSet,
32-
next: Option<PlaceRef<'tcx, 'tcx>>,
32+
next: Option<PlaceRef<'tcx>>,
3333
}
3434

3535
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
@@ -50,15 +50,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
5050
/// terminating the iteration early based on `kind`.
5151
pub(super) fn prefixes(
5252
&self,
53-
place_ref: PlaceRef<'tcx, 'tcx>,
53+
place_ref: PlaceRef<'tcx>,
5454
kind: PrefixSet,
5555
) -> Prefixes<'cx, 'tcx> {
5656
Prefixes { next: Some(place_ref), kind, body: self.body, tcx: self.infcx.tcx }
5757
}
5858
}
5959

6060
impl<'cx, 'tcx> Iterator for Prefixes<'cx, 'tcx> {
61-
type Item = PlaceRef<'tcx, 'tcx>;
61+
type Item = PlaceRef<'tcx>;
6262
fn next(&mut self) -> Option<Self::Item> {
6363
let mut cursor = self.next?;
6464

src/librustc_mir/dataflow/move_paths/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
483483
self.builder.data.loc_map[self.loc].push(move_out);
484484
}
485485

486-
fn gather_init(&mut self, place: PlaceRef<'tcx, 'tcx>, kind: InitKind) {
486+
fn gather_init(&mut self, place: PlaceRef<'tcx>, kind: InitKind) {
487487
debug!("gather_init({:?}, {:?})", self.loc, place);
488488

489489
let mut place = place;

src/librustc_mir/dataflow/move_paths/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl MovePathLookup {
312312
// alternative will *not* create a MovePath on the fly for an
313313
// unknown place, but will rather return the nearest available
314314
// parent.
315-
pub fn find(&self, place: PlaceRef<'_, '_>) -> LookupResult {
315+
pub fn find(&self, place: PlaceRef<'_>) -> LookupResult {
316316
let mut result = self.locals[place.local];
317317

318318
for elem in place.projection.iter() {

src/librustc_mir/transform/add_retag.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub struct AddRetag;
1414
/// after the assignment, we can be sure to obtain the same place value.
1515
/// (Concurrent accesses by other threads are no problem as these are anyway non-atomic
1616
/// copies. Data races are UB.)
17-
fn is_stable(place: PlaceRef<'_, '_>) -> bool {
17+
fn is_stable(place: PlaceRef<'_>) -> bool {
1818
place.projection.iter().all(|elem| {
1919
match elem {
2020
// Which place this evaluates to can change with any memory write,

src/librustc_mir/transform/check_consts/qualifs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub trait Qualif {
3535
fn in_projection_structurally(
3636
cx: &ConstCx<'_, 'tcx>,
3737
per_local: &mut impl FnMut(Local) -> bool,
38-
place: PlaceRef<'tcx, 'tcx>,
38+
place: PlaceRef<'tcx>,
3939
) -> bool {
4040
if let [proj_base @ .., elem] = place.projection {
4141
let base_qualif = Self::in_place(
@@ -67,15 +67,15 @@ pub trait Qualif {
6767
fn in_projection(
6868
cx: &ConstCx<'_, 'tcx>,
6969
per_local: &mut impl FnMut(Local) -> bool,
70-
place: PlaceRef<'tcx, 'tcx>,
70+
place: PlaceRef<'tcx>,
7171
) -> bool {
7272
Self::in_projection_structurally(cx, per_local, place)
7373
}
7474

7575
fn in_place(
7676
cx: &ConstCx<'_, 'tcx>,
7777
per_local: &mut impl FnMut(Local) -> bool,
78-
place: PlaceRef<'tcx, 'tcx>,
78+
place: PlaceRef<'tcx>,
7979
) -> bool {
8080
match place {
8181
PlaceRef { local, projection: [] } => per_local(local),

src/librustc_mir/transform/promote_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ impl<'tcx> Validator<'_, 'tcx> {
474474
}
475475
}
476476

477-
fn validate_place(&self, place: PlaceRef<'_, 'tcx>) -> Result<(), Unpromotable> {
477+
fn validate_place(&self, place: PlaceRef<'tcx>) -> Result<(), Unpromotable> {
478478
match place {
479479
PlaceRef { local, projection: [] } => self.validate_local(local),
480480
PlaceRef { local: _, projection: [proj_base @ .., elem] } => {

0 commit comments

Comments
 (0)