@@ -27,16 +27,15 @@ use std::marker::PhantomData;
27
27
use std:: mem;
28
28
use std:: path:: Path ;
29
29
30
- use super :: super :: MoveDataParamEnv ;
31
30
use super :: super :: MirBorrowckCtxtPreDataflow ;
32
31
use super :: { BitDenotation , DataflowState } ;
33
32
34
33
impl < O : BitDenotation > DataflowState < O > {
35
- fn each_bit < F > ( & self , ctxt : & O :: Ctxt , words : & IdxSet < O :: Idx > , mut f : F )
34
+ fn each_bit < F > ( & self , words : & IdxSet < O :: Idx > , mut f : F )
36
35
where F : FnMut ( O :: Idx ) {
37
36
//! Helper for iterating over the bits in a bitvector.
38
37
39
- let bits_per_block = self . operator . bits_per_block ( ctxt ) ;
38
+ let bits_per_block = self . operator . bits_per_block ( ) ;
40
39
let usize_bits: usize = mem:: size_of :: < usize > ( ) * 8 ;
41
40
42
41
for ( word_index, & word) in words. words ( ) . iter ( ) . enumerate ( ) {
@@ -65,35 +64,33 @@ impl<O: BitDenotation> DataflowState<O> {
65
64
}
66
65
67
66
pub fn interpret_set < ' c , P > ( & self ,
68
- ctxt : & ' c O :: Ctxt ,
67
+ o : & ' c O ,
69
68
words : & IdxSet < O :: Idx > ,
70
69
render_idx : & P )
71
70
-> Vec < & ' c Debug >
72
- where P : for < ' b > Fn ( & ' b O :: Ctxt , O :: Idx ) -> & ' b Debug
71
+ where P : Fn ( & O , O :: Idx ) -> & Debug
73
72
{
74
73
let mut v = Vec :: new ( ) ;
75
- self . each_bit ( ctxt , words, |i| {
76
- v. push ( render_idx ( ctxt , i) ) ;
74
+ self . each_bit ( words, |i| {
75
+ v. push ( render_idx ( o , i) ) ;
77
76
} ) ;
78
77
v
79
78
}
80
79
}
81
80
82
81
pub trait MirWithFlowState < ' tcx > {
83
- type BD : BitDenotation < Ctxt = MoveDataParamEnv < ' tcx > > ;
82
+ type BD : BitDenotation ;
84
83
fn node_id ( & self ) -> NodeId ;
85
84
fn mir ( & self ) -> & Mir < ' tcx > ;
86
- fn analysis_ctxt ( & self ) -> & <Self :: BD as BitDenotation >:: Ctxt ;
87
85
fn flow_state ( & self ) -> & DataflowState < Self :: BD > ;
88
86
}
89
87
90
88
impl < ' a , ' tcx : ' a , BD > MirWithFlowState < ' tcx > for MirBorrowckCtxtPreDataflow < ' a , ' tcx , BD >
91
- where ' tcx : ' a , BD : BitDenotation < Ctxt = MoveDataParamEnv < ' tcx > >
89
+ where ' tcx : ' a , BD : BitDenotation
92
90
{
93
91
type BD = BD ;
94
92
fn node_id ( & self ) -> NodeId { self . node_id }
95
93
fn mir ( & self ) -> & Mir < ' tcx > { self . flow_state . mir ( ) }
96
- fn analysis_ctxt ( & self ) -> & BD :: Ctxt { & self . flow_state . ctxt }
97
94
fn flow_state ( & self ) -> & DataflowState < Self :: BD > { & self . flow_state . flow_state }
98
95
}
99
96
@@ -110,8 +107,8 @@ pub fn print_borrowck_graph_to<'a, 'tcx, BD, P>(
110
107
path : & Path ,
111
108
render_idx : P )
112
109
-> io:: Result < ( ) >
113
- where BD : BitDenotation < Ctxt = MoveDataParamEnv < ' tcx > > ,
114
- P : for < ' b > Fn ( & ' b BD :: Ctxt , BD :: Idx ) -> & ' b Debug
110
+ where BD : BitDenotation ,
111
+ P : Fn ( & BD , BD :: Idx ) -> & Debug
115
112
{
116
113
let g = Graph { mbcx : mbcx, phantom : PhantomData , render_idx : render_idx } ;
117
114
let mut v = Vec :: new ( ) ;
@@ -133,9 +130,7 @@ fn outgoing(mir: &Mir, bb: BasicBlock) -> Vec<Edge> {
133
130
134
131
impl < ' a , ' tcx , MWF , P > dot:: Labeller < ' a > for Graph < ' a , ' tcx , MWF , P >
135
132
where MWF : MirWithFlowState < ' tcx > ,
136
- P : for < ' b > Fn ( & ' b <MWF :: BD as BitDenotation >:: Ctxt ,
137
- <MWF :: BD as BitDenotation >:: Idx )
138
- -> & ' b Debug ,
133
+ P : for < ' b > Fn ( & ' b MWF :: BD , <MWF :: BD as BitDenotation >:: Idx ) -> & ' b Debug ,
139
134
{
140
135
type Node = Node ;
141
136
type Edge = Edge ;
@@ -227,9 +222,8 @@ impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P>
227
222
:: rustc_mir:: graphviz:: write_node_label (
228
223
* n, self . mbcx . mir ( ) , & mut v, 4 ,
229
224
|w| {
230
- let ctxt = self . mbcx . analysis_ctxt ( ) ;
231
225
let flow = self . mbcx . flow_state ( ) ;
232
- let entry_interp = flow. interpret_set ( ctxt ,
226
+ let entry_interp = flow. interpret_set ( & flow . operator ,
233
227
flow. sets . on_entry_set_for ( i) ,
234
228
& self . render_idx ) ;
235
229
chunked_present_left ( w, & entry_interp[ ..] , chunk_size) ?;
@@ -244,12 +238,11 @@ impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P>
244
238
entrybits=bits_to_string( entry. words( ) , bits_per_block) )
245
239
} ,
246
240
|w| {
247
- let ctxt = self . mbcx . analysis_ctxt ( ) ;
248
241
let flow = self . mbcx . flow_state ( ) ;
249
242
let gen_interp =
250
- flow. interpret_set ( ctxt , flow. sets . gen_set_for ( i) , & self . render_idx ) ;
243
+ flow. interpret_set ( & flow . operator , flow. sets . gen_set_for ( i) , & self . render_idx ) ;
251
244
let kill_interp =
252
- flow. interpret_set ( ctxt , flow. sets . kill_set_for ( i) , & self . render_idx ) ;
245
+ flow. interpret_set ( & flow . operator , flow. sets . kill_set_for ( i) , & self . render_idx ) ;
253
246
chunked_present_left ( w, & gen_interp[ ..] , chunk_size) ?;
254
247
let bits_per_block = flow. sets . bits_per_block ( ) ;
255
248
{
0 commit comments