@@ -15,24 +15,24 @@ use tracing::debug;
15
15
use crate :: { places_conflict, BorrowSet , PlaceConflictBias , PlaceExt , RegionInferenceContext } ;
16
16
17
17
/// The results of the dataflow analyses used by the borrow checker.
18
- pub ( crate ) struct BorrowckResults < ' a , ' mir , ' tcx > {
19
- pub ( crate ) borrows : Results < ' tcx , Borrows < ' a , ' mir , ' tcx > > ,
20
- pub ( crate ) uninits : Results < ' tcx , MaybeUninitializedPlaces < ' a , ' mir , ' tcx > > ,
21
- pub ( crate ) ever_inits : Results < ' tcx , EverInitializedPlaces < ' a , ' mir , ' tcx > > ,
18
+ pub ( crate ) struct BorrowckResults < ' a , ' tcx > {
19
+ pub ( crate ) borrows : Results < ' tcx , Borrows < ' a , ' tcx > > ,
20
+ pub ( crate ) uninits : Results < ' tcx , MaybeUninitializedPlaces < ' a , ' tcx > > ,
21
+ pub ( crate ) ever_inits : Results < ' tcx , EverInitializedPlaces < ' a , ' tcx > > ,
22
22
}
23
23
24
24
/// The transient state of the dataflow analyses used by the borrow checker.
25
25
#[ derive( Debug ) ]
26
- pub ( crate ) struct BorrowckFlowState < ' a , ' mir , ' tcx > {
27
- pub ( crate ) borrows : <Borrows < ' a , ' mir , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
28
- pub ( crate ) uninits : <MaybeUninitializedPlaces < ' a , ' mir , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
29
- pub ( crate ) ever_inits : <EverInitializedPlaces < ' a , ' mir , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
26
+ pub ( crate ) struct BorrowckFlowState < ' a , ' tcx > {
27
+ pub ( crate ) borrows : <Borrows < ' a , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
28
+ pub ( crate ) uninits : <MaybeUninitializedPlaces < ' a , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
29
+ pub ( crate ) ever_inits : <EverInitializedPlaces < ' a , ' tcx > as AnalysisDomain < ' tcx > >:: Domain ,
30
30
}
31
31
32
- impl < ' a , ' mir , ' tcx > ResultsVisitable < ' tcx > for BorrowckResults < ' a , ' mir , ' tcx > {
32
+ impl < ' a , ' tcx > ResultsVisitable < ' tcx > for BorrowckResults < ' a , ' tcx > {
33
33
// All three analyses are forward, but we have to use just one here.
34
- type Direction = <Borrows < ' a , ' mir , ' tcx > as AnalysisDomain < ' tcx > >:: Direction ;
35
- type FlowState = BorrowckFlowState < ' a , ' mir , ' tcx > ;
34
+ type Direction = <Borrows < ' a , ' tcx > as AnalysisDomain < ' tcx > >:: Direction ;
35
+ type FlowState = BorrowckFlowState < ' a , ' tcx > ;
36
36
37
37
fn new_flow_state ( & self , body : & mir:: Body < ' tcx > ) -> Self :: FlowState {
38
38
BorrowckFlowState {
@@ -106,10 +106,9 @@ rustc_index::newtype_index! {
106
106
/// `BorrowIndex`, and maps each such index to a `BorrowData`
107
107
/// describing the borrow. These indexes are used for representing the
108
108
/// borrows in compact bitvectors.
109
- pub struct Borrows < ' a , ' mir , ' tcx > {
109
+ pub struct Borrows < ' a , ' tcx > {
110
110
tcx : TyCtxt < ' tcx > ,
111
- body : & ' mir Body < ' tcx > ,
112
-
111
+ body : & ' a Body < ' tcx > ,
113
112
borrow_set : & ' a BorrowSet < ' tcx > ,
114
113
borrows_out_of_scope_at_location : FxIndexMap < Location , Vec < BorrowIndex > > ,
115
114
}
@@ -389,10 +388,10 @@ impl<'tcx> PoloniusOutOfScopePrecomputer<'_, 'tcx> {
389
388
}
390
389
}
391
390
392
- impl < ' a , ' mir , ' tcx > Borrows < ' a , ' mir , ' tcx > {
391
+ impl < ' a , ' tcx > Borrows < ' a , ' tcx > {
393
392
pub fn new (
394
393
tcx : TyCtxt < ' tcx > ,
395
- body : & ' mir Body < ' tcx > ,
394
+ body : & ' a Body < ' tcx > ,
396
395
regioncx : & RegionInferenceContext < ' tcx > ,
397
396
borrow_set : & ' a BorrowSet < ' tcx > ,
398
397
) -> Self {
@@ -494,7 +493,7 @@ impl<'a, 'mir, 'tcx> Borrows<'a, 'mir, 'tcx> {
494
493
}
495
494
}
496
495
497
- impl < ' tcx > rustc_mir_dataflow:: AnalysisDomain < ' tcx > for Borrows < ' _ , ' _ , ' tcx > {
496
+ impl < ' tcx > rustc_mir_dataflow:: AnalysisDomain < ' tcx > for Borrows < ' _ , ' tcx > {
498
497
type Domain = BitSet < BorrowIndex > ;
499
498
500
499
const NAME : & ' static str = "borrows" ;
@@ -517,7 +516,7 @@ impl<'tcx> rustc_mir_dataflow::AnalysisDomain<'tcx> for Borrows<'_, '_, 'tcx> {
517
516
/// region stops containing the CFG points reachable from the issuing location.
518
517
/// - we also kill loans of conflicting places when overwriting a shared path: e.g. borrows of
519
518
/// `a.b.c` when `a` is overwritten.
520
- impl < ' tcx > rustc_mir_dataflow:: GenKillAnalysis < ' tcx > for Borrows < ' _ , ' _ , ' tcx > {
519
+ impl < ' tcx > rustc_mir_dataflow:: GenKillAnalysis < ' tcx > for Borrows < ' _ , ' tcx > {
521
520
type Idx = BorrowIndex ;
522
521
523
522
fn domain_size ( & self , _: & mir:: Body < ' tcx > ) -> usize {
@@ -617,8 +616,8 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, '_, 'tcx> {
617
616
}
618
617
}
619
618
620
- impl DebugWithContext < Borrows < ' _ , ' _ , ' _ > > for BorrowIndex {
621
- fn fmt_with ( & self , ctxt : & Borrows < ' _ , ' _ , ' _ > , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
619
+ impl DebugWithContext < Borrows < ' _ , ' _ > > for BorrowIndex {
620
+ fn fmt_with ( & self , ctxt : & Borrows < ' _ , ' _ > , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
622
621
write ! ( f, "{:?}" , ctxt. location( * self ) )
623
622
}
624
623
}
0 commit comments