@@ -11,7 +11,6 @@ use crate::borrow_check::{
11
11
use crate :: dataflow:: { self , fmt:: DebugWithContext , GenKill } ;
12
12
13
13
use std:: fmt;
14
- use std:: rc:: Rc ;
15
14
16
15
rustc_index:: newtype_index! {
17
16
pub struct BorrowIndex {
@@ -30,11 +29,8 @@ pub struct Borrows<'a, 'tcx> {
30
29
tcx : TyCtxt < ' tcx > ,
31
30
body : & ' a Body < ' tcx > ,
32
31
33
- borrow_set : Rc < BorrowSet < ' tcx > > ,
32
+ borrow_set : & ' a BorrowSet < ' tcx > ,
34
33
borrows_out_of_scope_at_location : FxHashMap < Location , Vec < BorrowIndex > > ,
35
-
36
- /// NLL region inference context with which NLL queries should be resolved
37
- _nonlexical_regioncx : Rc < RegionInferenceContext < ' tcx > > ,
38
34
}
39
35
40
36
struct StackEntry {
@@ -47,12 +43,12 @@ struct OutOfScopePrecomputer<'a, 'tcx> {
47
43
visited : BitSet < mir:: BasicBlock > ,
48
44
visit_stack : Vec < StackEntry > ,
49
45
body : & ' a Body < ' tcx > ,
50
- regioncx : Rc < RegionInferenceContext < ' tcx > > ,
46
+ regioncx : & ' a RegionInferenceContext < ' tcx > ,
51
47
borrows_out_of_scope_at_location : FxHashMap < Location , Vec < BorrowIndex > > ,
52
48
}
53
49
54
50
impl < ' a , ' tcx > OutOfScopePrecomputer < ' a , ' tcx > {
55
- fn new ( body : & ' a Body < ' tcx > , regioncx : Rc < RegionInferenceContext < ' tcx > > ) -> Self {
51
+ fn new ( body : & ' a Body < ' tcx > , regioncx : & ' a RegionInferenceContext < ' tcx > ) -> Self {
56
52
OutOfScopePrecomputer {
57
53
visited : BitSet :: new_empty ( body. basic_blocks ( ) . len ( ) ) ,
58
54
visit_stack : vec ! [ ] ,
@@ -147,10 +143,10 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
147
143
crate fn new (
148
144
tcx : TyCtxt < ' tcx > ,
149
145
body : & ' a Body < ' tcx > ,
150
- nonlexical_regioncx : Rc < RegionInferenceContext < ' tcx > > ,
151
- borrow_set : Rc < BorrowSet < ' tcx > > ,
146
+ nonlexical_regioncx : & ' a RegionInferenceContext < ' tcx > ,
147
+ borrow_set : & ' a BorrowSet < ' tcx > ,
152
148
) -> Self {
153
- let mut prec = OutOfScopePrecomputer :: new ( body, nonlexical_regioncx. clone ( ) ) ;
149
+ let mut prec = OutOfScopePrecomputer :: new ( body, nonlexical_regioncx) ;
154
150
for ( borrow_index, borrow_data) in borrow_set. iter_enumerated ( ) {
155
151
let borrow_region = borrow_data. region . to_region_vid ( ) ;
156
152
let location = borrow_data. reserve_location ;
@@ -163,7 +159,6 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
163
159
body,
164
160
borrow_set,
165
161
borrows_out_of_scope_at_location : prec. borrows_out_of_scope_at_location ,
166
- _nonlexical_regioncx : nonlexical_regioncx,
167
162
}
168
163
}
169
164
0 commit comments