@@ -5,7 +5,8 @@ use std::path::PathBuf;
55use std:: rc:: Rc ;
66use std:: str:: FromStr ;
77
8- use polonius_engine:: { Algorithm , Output } ;
8+ use polonius_engine:: { Algorithm , AllFacts , Output } ;
9+ use rustc_data_structures:: frozen:: Frozen ;
910use rustc_index:: IndexSlice ;
1011use rustc_middle:: mir:: pretty:: { PrettyPrintMirOptions , dump_mir_with_options} ;
1112use rustc_middle:: mir:: { Body , PassWhere , Promoted , create_dump_file, dump_enabled, dump_mir} ;
@@ -18,14 +19,16 @@ use rustc_span::sym;
1819use tracing:: { debug, instrument} ;
1920
2021use crate :: borrow_set:: BorrowSet ;
22+ use crate :: consumers:: RustcFacts ;
2123use crate :: diagnostics:: RegionErrors ;
2224use crate :: handle_placeholders:: compute_sccs_applying_placeholder_outlives_constraints;
23- use crate :: polonius:: PoloniusDiagnosticsContext ;
2425use crate :: polonius:: legacy:: {
2526 PoloniusFacts , PoloniusFactsExt , PoloniusLocationTable , PoloniusOutput ,
2627} ;
28+ use crate :: polonius:: { PoloniusContext , PoloniusDiagnosticsContext } ;
2729use crate :: region_infer:: RegionInferenceContext ;
28- use crate :: type_check:: { self , MirTypeckResults } ;
30+ use crate :: type_check:: MirTypeckRegionConstraints ;
31+ use crate :: type_check:: free_region_relations:: UniversalRegionRelations ;
2932use crate :: universal_regions:: UniversalRegions ;
3033use crate :: {
3134 BorrowCheckRootCtxt , BorrowckInferCtxt , ClosureOutlivesSubject , ClosureRegionRequirements ,
@@ -76,41 +79,18 @@ pub(crate) fn replace_regions_in_mir<'tcx>(
7679pub ( crate ) fn compute_regions < ' tcx > (
7780 root_cx : & mut BorrowCheckRootCtxt < ' tcx > ,
7881 infcx : & BorrowckInferCtxt < ' tcx > ,
79- universal_regions : UniversalRegions < ' tcx > ,
8082 body : & Body < ' tcx > ,
81- promoted : & IndexSlice < Promoted , Body < ' tcx > > ,
8283 location_table : & PoloniusLocationTable ,
8384 move_data : & MoveData < ' tcx > ,
8485 borrow_set : & BorrowSet < ' tcx > ,
86+ location_map : Rc < DenseLocationMap > ,
87+ universal_region_relations : Frozen < UniversalRegionRelations < ' tcx > > ,
88+ constraints : MirTypeckRegionConstraints < ' tcx > ,
89+ mut polonius_facts : Option < AllFacts < RustcFacts > > ,
90+ polonius_context : Option < PoloniusContext > ,
8591) -> NllOutput < ' tcx > {
86- let is_polonius_legacy_enabled = infcx. tcx . sess . opts . unstable_opts . polonius . is_legacy_enabled ( ) ;
87- let polonius_input = root_cx. consumer . as_ref ( ) . map_or ( false , |c| c. polonius_input ( ) )
88- || is_polonius_legacy_enabled;
8992 let polonius_output = root_cx. consumer . as_ref ( ) . map_or ( false , |c| c. polonius_output ( ) )
90- || is_polonius_legacy_enabled;
91- let mut polonius_facts =
92- ( polonius_input || PoloniusFacts :: enabled ( infcx. tcx ) ) . then_some ( PoloniusFacts :: default ( ) ) ;
93-
94- let location_map = Rc :: new ( DenseLocationMap :: new ( body) ) ;
95-
96- // Run the MIR type-checker.
97- let MirTypeckResults {
98- constraints,
99- universal_region_relations,
100- opaque_type_values,
101- polonius_context,
102- } = type_check:: type_check (
103- root_cx,
104- infcx,
105- body,
106- promoted,
107- universal_regions,
108- location_table,
109- borrow_set,
110- & mut polonius_facts,
111- move_data,
112- Rc :: clone ( & location_map) ,
113- ) ;
93+ || infcx. tcx . sess . opts . unstable_opts . polonius . is_legacy_enabled ( ) ;
11494
11595 let lowered_constraints = compute_sccs_applying_placeholder_outlives_constraints (
11696 constraints,
@@ -173,8 +153,6 @@ pub(crate) fn compute_regions<'tcx>(
173153 infcx. set_tainted_by_errors ( guar) ;
174154 }
175155
176- regioncx. infer_opaque_types ( root_cx, infcx, opaque_type_values) ;
177-
178156 NllOutput {
179157 regioncx,
180158 polonius_input : polonius_facts. map ( Box :: new) ,
0 commit comments