@@ -6,7 +6,7 @@ use std::rc::Rc;
6
6
use std:: str:: FromStr ;
7
7
8
8
use polonius_engine:: { Algorithm , Output } ;
9
- use rustc_index:: IndexSlice ;
9
+ use rustc_index:: { IndexSlice , IndexVec } ;
10
10
use rustc_middle:: mir:: pretty:: { PrettyPrintMirOptions , dump_mir_with_options} ;
11
11
use rustc_middle:: mir:: { Body , PassWhere , Promoted , create_dump_file, dump_enabled, dump_mir} ;
12
12
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
@@ -26,7 +26,8 @@ use crate::polonius::PoloniusDiagnosticsContext;
26
26
use crate :: polonius:: legacy:: {
27
27
PoloniusFacts , PoloniusFactsExt , PoloniusLocationTable , PoloniusOutput ,
28
28
} ;
29
- use crate :: region_infer:: RegionInferenceContext ;
29
+ use crate :: region_infer:: opaque_types:: handle_opaque_type_uses;
30
+ use crate :: region_infer:: { RegionDefinition , RegionInferenceContext } ;
30
31
use crate :: type_check:: { self , MirTypeckResults } ;
31
32
use crate :: universal_regions:: UniversalRegions ;
32
33
use crate :: {
@@ -98,30 +99,29 @@ pub(crate) fn compute_regions<'a, 'tcx>(
98
99
let location_map = Rc :: new ( DenseLocationMap :: new ( body) ) ;
99
100
100
101
// Run the MIR type-checker.
101
- let MirTypeckResults {
102
- constraints,
103
- universal_region_relations,
104
- opaque_type_values,
105
- polonius_context,
106
- } = type_check:: type_check (
102
+ let MirTypeckResults { constraints, universal_region_relations, polonius_context } =
103
+ type_check:: type_check (
104
+ root_cx,
105
+ infcx,
106
+ body,
107
+ promoted,
108
+ universal_regions,
109
+ location_table,
110
+ borrow_set,
111
+ & mut polonius_facts,
112
+ flow_inits,
113
+ move_data,
114
+ Rc :: clone ( & location_map) ,
115
+ ) ;
116
+
117
+ let constraints = handle_opaque_type_uses (
107
118
root_cx,
108
119
infcx,
109
- body,
110
- promoted,
111
- universal_regions,
112
- location_table,
113
- borrow_set,
114
- & mut polonius_facts,
115
- flow_inits,
116
- move_data,
120
+ constraints,
121
+ & universal_region_relations,
117
122
Rc :: clone ( & location_map) ,
118
123
) ;
119
124
120
- // Create the region inference context, taking ownership of the
121
- // region inference data that was contained in `infcx`, and the
122
- // base constraints generated by the type-check.
123
- let var_infos = infcx. get_region_var_infos ( ) ;
124
-
125
125
// If requested, emit legacy polonius facts.
126
126
polonius:: legacy:: emit_facts (
127
127
& mut polonius_facts,
@@ -134,13 +134,8 @@ pub(crate) fn compute_regions<'a, 'tcx>(
134
134
& constraints,
135
135
) ;
136
136
137
- let mut regioncx = RegionInferenceContext :: new (
138
- infcx,
139
- var_infos,
140
- constraints,
141
- universal_region_relations,
142
- location_map,
143
- ) ;
137
+ let mut regioncx =
138
+ RegionInferenceContext :: new ( infcx, constraints, universal_region_relations, location_map) ;
144
139
145
140
// If requested for `-Zpolonius=next`, convert NLL constraints to localized outlives constraints
146
141
// and use them to compute loan liveness.
@@ -173,13 +168,12 @@ pub(crate) fn compute_regions<'a, 'tcx>(
173
168
let ( closure_region_requirements, nll_errors) =
174
169
regioncx. solve ( infcx, body, polonius_output. clone ( ) ) ;
175
170
171
+ // TODO: TRY YEET
176
172
if let Some ( guar) = nll_errors. has_errors ( ) {
177
173
// Suppress unhelpful extra errors in `infer_opaque_types`.
178
174
infcx. set_tainted_by_errors ( guar) ;
179
175
}
180
176
181
- regioncx. infer_opaque_types ( root_cx, infcx, opaque_type_values) ;
182
-
183
177
NllOutput {
184
178
regioncx,
185
179
polonius_input : polonius_facts. map ( Box :: new) ,
0 commit comments