@@ -13,34 +13,39 @@ use super::*;
1313#[ derive( Debug ) ]
1414pub ( super ) struct TaintSet < ' tcx > {
1515 directions : TaintDirections ,
16- regions : FxHashSet < ty:: Region < ' tcx > >
16+ regions : FxHashSet < ty:: Region < ' tcx > > ,
1717}
1818
1919impl < ' 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 {
2321 let mut regions = FxHashSet ( ) ;
2422 regions. insert ( initial_region) ;
25- TaintSet { directions : directions, regions : regions }
23+ TaintSet {
24+ directions : directions,
25+ regions : regions,
26+ }
2627 }
2728
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+ ) {
3235 let mut prev_len = 0 ;
3336 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+ ) ;
3642
3743 prev_len = self . len ( ) ;
3844
3945 for undo_entry in undo_log {
4046 match undo_entry {
4147 & 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) ) ) ;
4449 }
4550 & AddConstraint ( Constraint :: RegSubVar ( a, b) ) => {
4651 self . add_edge ( a, tcx. mk_region ( ReVar ( b) ) ) ;
@@ -55,15 +60,13 @@ impl<'tcx> TaintSet<'tcx> {
5560 self . add_edge ( a, tcx. mk_region ( ReVar ( b) ) ) ;
5661 }
5762 & 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+ )
6167 }
62- & Purged |
63- & AddCombination ( ..) |
64- & AddVar ( ..) |
65- & OpenSnapshot |
66- & CommitedSnapshot => { }
68+ & Purged | & AddCombination ( ..) | & AddVar ( ..) | & OpenSnapshot
69+ | & CommitedSnapshot => { }
6770 }
6871 }
6972 }
@@ -77,9 +80,7 @@ impl<'tcx> TaintSet<'tcx> {
7780 self . regions . len ( )
7881 }
7982
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 > ) {
8384 if self . directions . incoming {
8485 if self . regions . contains ( & target) {
8586 self . regions . insert ( source) ;
@@ -93,4 +94,3 @@ impl<'tcx> TaintSet<'tcx> {
9394 }
9495 }
9596}
96-
0 commit comments