@@ -86,6 +86,8 @@ crate struct Upvar {
8686 mutability : Mutability ,
8787}
8888
89+ const DEREF_PROJECTION : & [ PlaceElem < ' _ > ; 1 ] = & [ ProjectionElem :: Deref ] ;
90+
8991pub fn provide ( providers : & mut Providers < ' _ > ) {
9092 * providers = Providers { mir_borrowck, ..* providers } ;
9193}
@@ -466,10 +468,10 @@ crate struct MirBorrowckCtxt<'cx, 'tcx> {
466468 /// `BTreeMap` is used to preserve the order of insertions when iterating. This is necessary
467469 /// when errors in the map are being re-added to the error buffer so that errors with the
468470 /// same primary span come out in a consistent order.
469- move_error_reported : BTreeMap < Vec < MoveOutIndex > , ( PlaceRef < ' cx , ' tcx > , DiagnosticBuilder < ' cx > ) > ,
471+ move_error_reported : BTreeMap < Vec < MoveOutIndex > , ( PlaceRef < ' tcx > , DiagnosticBuilder < ' cx > ) > ,
470472 /// This field keeps track of errors reported in the checking of uninitialized variables,
471473 /// so that we don't report seemingly duplicate errors.
472- uninitialized_error_reported : FxHashSet < PlaceRef < ' cx , ' tcx > > ,
474+ uninitialized_error_reported : FxHashSet < PlaceRef < ' tcx > > ,
473475 /// Errors to be reported buffer
474476 errors_buffer : Vec < Diagnostic > ,
475477 /// This field keeps track of all the local variables that are declared mut and are mutated.
@@ -841,9 +843,9 @@ enum InitializationRequiringAction {
841843 PartialAssignment ,
842844}
843845
844- struct RootPlace < ' d , ' tcx > {
846+ struct RootPlace < ' tcx > {
845847 place_local : Local ,
846- place_projection : & ' d [ PlaceElem < ' tcx > ] ,
848+ place_projection : & ' tcx [ PlaceElem < ' tcx > ] ,
847849 is_local_mutation_allowed : LocalMutationIsAllowed ,
848850}
849851
@@ -1413,7 +1415,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14131415 ) {
14141416 debug ! ( "check_for_invalidation_at_exit({:?})" , borrow) ;
14151417 let place = & borrow. borrowed_place ;
1416- let deref = [ ProjectionElem :: Deref ] ;
14171418 let mut root_place = PlaceRef { local : place. local , projection : & [ ] } ;
14181419
14191420 // FIXME(nll-rfc#40): do more precise destructor tracking here. For now
@@ -1427,7 +1428,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14271428 // Thread-locals might be dropped after the function exits
14281429 // We have to dereference the outer reference because
14291430 // borrows don't conflict behind shared references.
1430- root_place. projection = & deref ;
1431+ root_place. projection = DEREF_PROJECTION ;
14311432 ( true , true )
14321433 } else {
14331434 ( false , self . locals_are_invalidated_at_exit )
@@ -1526,7 +1527,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15261527 & mut self ,
15271528 location : Location ,
15281529 desired_action : InitializationRequiringAction ,
1529- place_span : ( PlaceRef < ' cx , ' tcx > , Span ) ,
1530+ place_span : ( PlaceRef < ' tcx > , Span ) ,
15301531 flow_state : & Flows < ' cx , ' tcx > ,
15311532 ) {
15321533 let maybe_uninits = & flow_state. uninits ;
@@ -1592,7 +1593,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15921593 & mut self ,
15931594 location : Location ,
15941595 desired_action : InitializationRequiringAction ,
1595- place_span : ( PlaceRef < ' cx , ' tcx > , Span ) ,
1596+ place_span : ( PlaceRef < ' tcx > , Span ) ,
15961597 maybe_uninits : & BitSet < MovePathIndex > ,
15971598 from : u32 ,
15981599 to : u32 ,
@@ -1631,7 +1632,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16311632 & mut self ,
16321633 location : Location ,
16331634 desired_action : InitializationRequiringAction ,
1634- place_span : ( PlaceRef < ' cx , ' tcx > , Span ) ,
1635+ place_span : ( PlaceRef < ' tcx > , Span ) ,
16351636 flow_state : & Flows < ' cx , ' tcx > ,
16361637 ) {
16371638 let maybe_uninits = & flow_state. uninits ;
@@ -1709,10 +1710,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
17091710 /// An Err result includes a tag indicated why the search failed.
17101711 /// Currently this can only occur if the place is built off of a
17111712 /// static variable, as we do not track those in the MoveData.
1712- fn move_path_closest_to (
1713- & mut self ,
1714- place : PlaceRef < ' _ , ' tcx > ,
1715- ) -> ( PlaceRef < ' cx , ' tcx > , MovePathIndex ) {
1713+ fn move_path_closest_to ( & mut self , place : PlaceRef < ' tcx > ) -> ( PlaceRef < ' tcx > , MovePathIndex ) {
17161714 match self . move_data . rev_lookup . find ( place) {
17171715 LookupResult :: Parent ( Some ( mpi) ) | LookupResult :: Exact ( mpi) => {
17181716 ( self . move_data . move_paths [ mpi] . place . as_ref ( ) , mpi)
@@ -1721,7 +1719,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
17211719 }
17221720 }
17231721
1724- fn move_path_for_place ( & mut self , place : PlaceRef < ' _ , ' tcx > ) -> Option < MovePathIndex > {
1722+ fn move_path_for_place ( & mut self , place : PlaceRef < ' tcx > ) -> Option < MovePathIndex > {
17251723 // If returns None, then there is no move path corresponding
17261724 // to a direct owner of `place` (which means there is nothing
17271725 // that borrowck tracks for its analysis).
@@ -1816,7 +1814,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
18161814 fn check_parent_of_field < ' cx , ' tcx > (
18171815 this : & mut MirBorrowckCtxt < ' cx , ' tcx > ,
18181816 location : Location ,
1819- base : PlaceRef < ' cx , ' tcx > ,
1817+ base : PlaceRef < ' tcx > ,
18201818 span : Span ,
18211819 flow_state : & Flows < ' cx , ' tcx > ,
18221820 ) {
@@ -2029,7 +2027,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20292027 }
20302028
20312029 /// Adds the place into the used mutable variables set
2032- fn add_used_mut < ' d > ( & mut self , root_place : RootPlace < ' d , ' tcx > , flow_state : & Flows < ' cx , ' tcx > ) {
2030+ fn add_used_mut ( & mut self , root_place : RootPlace < ' tcx > , flow_state : & Flows < ' cx , ' tcx > ) {
20332031 match root_place {
20342032 RootPlace { place_local : local, place_projection : [ ] , is_local_mutation_allowed } => {
20352033 // If the local may have been initialized, and it is now currently being
@@ -2063,11 +2061,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20632061
20642062 /// Whether this value can be written or borrowed mutably.
20652063 /// Returns the root place if the place passed in is a projection.
2066- fn is_mutable < ' d > (
2064+ fn is_mutable (
20672065 & self ,
2068- place : PlaceRef < ' d , ' tcx > ,
2066+ place : PlaceRef < ' tcx > ,
20692067 is_local_mutation_allowed : LocalMutationIsAllowed ,
2070- ) -> Result < RootPlace < ' d , ' tcx > , PlaceRef < ' d , ' tcx > > {
2068+ ) -> Result < RootPlace < ' tcx > , PlaceRef < ' tcx > > {
20712069 match place {
20722070 PlaceRef { local, projection : [ ] } => {
20732071 let local = & self . body . local_decls [ local] ;
@@ -2218,7 +2216,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22182216 /// then returns the index of the field being projected. Note that this closure will always
22192217 /// be `self` in the current MIR, because that is the only time we directly access the fields
22202218 /// of a closure type.
2221- pub fn is_upvar_field_projection ( & self , place_ref : PlaceRef < ' cx , ' tcx > ) -> Option < Field > {
2219+ pub fn is_upvar_field_projection ( & self , place_ref : PlaceRef < ' tcx > ) -> Option < Field > {
22222220 let mut place_projection = place_ref. projection ;
22232221 let mut by_ref = false ;
22242222
0 commit comments