@@ -6,7 +6,7 @@ use std::rc::Rc;
66use std:: str:: FromStr ;
77
88use polonius_engine:: { Algorithm , Output } ;
9- use rustc_index:: IndexSlice ;
9+ use rustc_index:: { IndexSlice , IndexVec } ;
1010use rustc_middle:: mir:: pretty:: { PrettyPrintMirOptions , dump_mir_with_options} ;
1111use rustc_middle:: mir:: { Body , PassWhere , Promoted , create_dump_file, dump_enabled, dump_mir} ;
1212use rustc_middle:: ty:: print:: with_no_trimmed_paths;
@@ -26,7 +26,8 @@ use crate::polonius::PoloniusDiagnosticsContext;
2626use crate :: polonius:: legacy:: {
2727 PoloniusFacts , PoloniusFactsExt , PoloniusLocationTable , PoloniusOutput ,
2828} ;
29- use crate :: region_infer:: RegionInferenceContext ;
29+ use crate :: region_infer:: opaque_types:: handle_opaque_type_uses;
30+ use crate :: region_infer:: { RegionDefinition , RegionInferenceContext } ;
3031use crate :: type_check:: { self , MirTypeckResults } ;
3132use crate :: universal_regions:: UniversalRegions ;
3233use crate :: {
@@ -98,30 +99,29 @@ pub(crate) fn compute_regions<'a, 'tcx>(
9899 let location_map = Rc :: new ( DenseLocationMap :: new ( body) ) ;
99100
100101 // 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 (
107118 root_cx,
108119 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,
117122 Rc :: clone ( & location_map) ,
118123 ) ;
119124
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-
125125 // If requested, emit legacy polonius facts.
126126 polonius:: legacy:: emit_facts (
127127 & mut polonius_facts,
@@ -134,13 +134,8 @@ pub(crate) fn compute_regions<'a, 'tcx>(
134134 & constraints,
135135 ) ;
136136
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) ;
144139
145140 // If requested for `-Zpolonius=next`, convert NLL constraints to localized outlives constraints
146141 // and use them to compute loan liveness.
@@ -173,13 +168,12 @@ pub(crate) fn compute_regions<'a, 'tcx>(
173168 let ( closure_region_requirements, nll_errors) =
174169 regioncx. solve ( infcx, body, polonius_output. clone ( ) ) ;
175170
171+ // TODO: TRY YEET
176172 if let Some ( guar) = nll_errors. has_errors ( ) {
177173 // Suppress unhelpful extra errors in `infer_opaque_types`.
178174 infcx. set_tainted_by_errors ( guar) ;
179175 }
180176
181- regioncx. infer_opaque_types ( root_cx, infcx, opaque_type_values) ;
182-
183177 NllOutput {
184178 regioncx,
185179 polonius_input : polonius_facts. map ( Box :: new) ,
0 commit comments