@@ -13,34 +13,39 @@ use super::*;
13
13
#[ derive( Debug ) ]
14
14
pub ( super ) struct TaintSet < ' tcx > {
15
15
directions : TaintDirections ,
16
- regions : FxHashSet < ty:: Region < ' tcx > >
16
+ regions : FxHashSet < ty:: Region < ' tcx > > ,
17
17
}
18
18
19
19
impl < ' tcx > TaintSet < ' tcx > {
20
- pub ( super ) fn new ( directions : TaintDirections ,
21
- initial_region : ty:: Region < ' tcx > )
22
- -> Self {
20
+ pub ( super ) fn new ( directions : TaintDirections , initial_region : ty:: Region < ' tcx > ) -> Self {
23
21
let mut regions = FxHashSet ( ) ;
24
22
regions. insert ( initial_region) ;
25
- TaintSet { directions : directions, regions : regions }
23
+ TaintSet {
24
+ directions : directions,
25
+ regions : regions,
26
+ }
26
27
}
27
28
28
- pub ( super ) fn fixed_point ( & mut self ,
29
- tcx : TyCtxt < ' _ , ' _ , ' tcx > ,
30
- undo_log : & [ UndoLogEntry < ' tcx > ] ,
31
- verifys : & [ Verify < ' tcx > ] ) {
29
+ pub ( super ) fn fixed_point (
30
+ & mut self ,
31
+ tcx : TyCtxt < ' _ , ' _ , ' tcx > ,
32
+ undo_log : & [ UndoLogEntry < ' tcx > ] ,
33
+ verifys : & [ Verify < ' tcx > ] ,
34
+ ) {
32
35
let mut prev_len = 0 ;
33
36
while prev_len < self . len ( ) {
34
- debug ! ( "tainted: prev_len = {:?} new_len = {:?}" ,
35
- prev_len, self . len( ) ) ;
37
+ debug ! (
38
+ "tainted: prev_len = {:?} new_len = {:?}" ,
39
+ prev_len,
40
+ self . len( )
41
+ ) ;
36
42
37
43
prev_len = self . len ( ) ;
38
44
39
45
for undo_entry in undo_log {
40
46
match undo_entry {
41
47
& AddConstraint ( Constraint :: VarSubVar ( a, b) ) => {
42
- self . add_edge ( tcx. mk_region ( ReVar ( a) ) ,
43
- tcx. mk_region ( ReVar ( b) ) ) ;
48
+ self . add_edge ( tcx. mk_region ( ReVar ( a) ) , tcx. mk_region ( ReVar ( b) ) ) ;
44
49
}
45
50
& AddConstraint ( Constraint :: RegSubVar ( a, b) ) => {
46
51
self . add_edge ( a, tcx. mk_region ( ReVar ( b) ) ) ;
@@ -55,15 +60,13 @@ impl<'tcx> TaintSet<'tcx> {
55
60
self . add_edge ( a, tcx. mk_region ( ReVar ( b) ) ) ;
56
61
}
57
62
& AddVerify ( i) => {
58
- verifys[ i] . bound . for_each_region ( & mut |b| {
59
- self . add_edge ( verifys[ i] . region , b) ;
60
- } ) ;
63
+ span_bug ! (
64
+ verifys[ i] . origin. span( ) ,
65
+ "we never add verifications while doing higher-ranked things" ,
66
+ )
61
67
}
62
- & Purged |
63
- & AddCombination ( ..) |
64
- & AddVar ( ..) |
65
- & OpenSnapshot |
66
- & CommitedSnapshot => { }
68
+ & Purged | & AddCombination ( ..) | & AddVar ( ..) | & OpenSnapshot
69
+ | & CommitedSnapshot => { }
67
70
}
68
71
}
69
72
}
@@ -77,9 +80,7 @@ impl<'tcx> TaintSet<'tcx> {
77
80
self . regions . len ( )
78
81
}
79
82
80
- fn add_edge ( & mut self ,
81
- source : ty:: Region < ' tcx > ,
82
- target : ty:: Region < ' tcx > ) {
83
+ fn add_edge ( & mut self , source : ty:: Region < ' tcx > , target : ty:: Region < ' tcx > ) {
83
84
if self . directions . incoming {
84
85
if self . regions . contains ( & target) {
85
86
self . regions . insert ( source) ;
@@ -93,4 +94,3 @@ impl<'tcx> TaintSet<'tcx> {
93
94
}
94
95
}
95
96
}
96
-
0 commit comments