@@ -37,21 +37,20 @@ mod constraints;
37
37
mod dump;
38
38
pub ( crate ) mod legacy;
39
39
mod liveness_constraints;
40
+ mod typeck_constraints;
40
41
41
42
use std:: collections:: BTreeMap ;
42
43
43
44
use rustc_index:: bit_set:: SparseBitMatrix ;
44
- use rustc_middle:: mir:: { Body , Location } ;
45
+ use rustc_middle:: mir:: Body ;
45
46
use rustc_middle:: ty:: RegionVid ;
46
47
use rustc_mir_dataflow:: points:: PointIndex ;
47
48
48
49
pub ( crate ) use self :: constraints:: * ;
49
50
pub ( crate ) use self :: dump:: dump_polonius_mir;
50
51
use self :: liveness_constraints:: create_liveness_constraints;
52
+ use self :: typeck_constraints:: convert_typeck_constraints;
51
53
use crate :: RegionInferenceContext ;
52
- use crate :: constraints:: OutlivesConstraint ;
53
- use crate :: region_infer:: values:: LivenessValues ;
54
- use crate :: type_check:: Locations ;
55
54
56
55
/// This struct holds the data needed to create the Polonius localized constraints.
57
56
pub ( crate ) struct PoloniusContext {
@@ -117,38 +116,3 @@ impl PoloniusContext {
117
116
localized_outlives_constraints
118
117
}
119
118
}
120
-
121
- /// Propagate loans throughout the subset graph at a given point (with some subtleties around the
122
- /// location where effects start to be visible).
123
- fn convert_typeck_constraints < ' tcx > (
124
- body : & Body < ' tcx > ,
125
- liveness : & LivenessValues ,
126
- outlives_constraints : impl Iterator < Item = OutlivesConstraint < ' tcx > > ,
127
- localized_outlives_constraints : & mut LocalizedOutlivesConstraintSet ,
128
- ) {
129
- for outlives_constraint in outlives_constraints {
130
- match outlives_constraint. locations {
131
- Locations :: All ( _) => {
132
- // For now, turn logical constraints holding at all points into physical edges at
133
- // every point in the graph.
134
- // FIXME: encode this into *traversal* instead.
135
- for ( block, bb) in body. basic_blocks . iter_enumerated ( ) {
136
- let statement_count = bb. statements . len ( ) ;
137
- for statement_index in 0 ..=statement_count {
138
- let current_location = Location { block, statement_index } ;
139
- let current_point = liveness. point_from_location ( current_location) ;
140
-
141
- localized_outlives_constraints. push ( LocalizedOutlivesConstraint {
142
- source : outlives_constraint. sup ,
143
- from : current_point,
144
- target : outlives_constraint. sub ,
145
- to : current_point,
146
- } ) ;
147
- }
148
- }
149
- }
150
-
151
- _ => { }
152
- }
153
- }
154
- }
0 commit comments