@@ -5,7 +5,8 @@ use std::path::PathBuf;
5
5
use std:: rc:: Rc ;
6
6
use std:: str:: FromStr ;
7
7
8
- use polonius_engine:: { Algorithm , Output } ;
8
+ use polonius_engine:: { Algorithm , AllFacts , Output } ;
9
+ use rustc_data_structures:: frozen:: Frozen ;
9
10
use rustc_index:: IndexSlice ;
10
11
use rustc_middle:: mir:: pretty:: { PrettyPrintMirOptions , dump_mir_with_options} ;
11
12
use rustc_middle:: mir:: { Body , PassWhere , Promoted , create_dump_file, dump_enabled, dump_mir} ;
@@ -18,14 +19,16 @@ use rustc_span::sym;
18
19
use tracing:: { debug, instrument} ;
19
20
20
21
use crate :: borrow_set:: BorrowSet ;
22
+ use crate :: consumers:: RustcFacts ;
21
23
use crate :: diagnostics:: RegionErrors ;
22
24
use crate :: handle_placeholders:: compute_sccs_applying_placeholder_outlives_constraints;
23
- use crate :: polonius:: PoloniusDiagnosticsContext ;
24
25
use crate :: polonius:: legacy:: {
25
26
PoloniusFacts , PoloniusFactsExt , PoloniusLocationTable , PoloniusOutput ,
26
27
} ;
28
+ use crate :: polonius:: { PoloniusContext , PoloniusDiagnosticsContext } ;
27
29
use 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 ;
29
32
use crate :: universal_regions:: UniversalRegions ;
30
33
use crate :: {
31
34
BorrowCheckRootCtxt , BorrowckInferCtxt , ClosureOutlivesSubject , ClosureRegionRequirements ,
@@ -76,41 +79,18 @@ pub(crate) fn replace_regions_in_mir<'tcx>(
76
79
pub ( crate ) fn compute_regions < ' tcx > (
77
80
root_cx : & mut BorrowCheckRootCtxt < ' tcx > ,
78
81
infcx : & BorrowckInferCtxt < ' tcx > ,
79
- universal_regions : UniversalRegions < ' tcx > ,
80
82
body : & Body < ' tcx > ,
81
- promoted : & IndexSlice < Promoted , Body < ' tcx > > ,
82
83
location_table : & PoloniusLocationTable ,
83
84
move_data : & MoveData < ' tcx > ,
84
85
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 > ,
85
91
) -> 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;
89
92
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 ( ) ;
114
94
115
95
let lowered_constraints = compute_sccs_applying_placeholder_outlives_constraints (
116
96
constraints,
@@ -173,8 +153,6 @@ pub(crate) fn compute_regions<'tcx>(
173
153
infcx. set_tainted_by_errors ( guar) ;
174
154
}
175
155
176
- regioncx. infer_opaque_types ( root_cx, infcx, opaque_type_values) ;
177
-
178
156
NllOutput {
179
157
regioncx,
180
158
polonius_input : polonius_facts. map ( Box :: new) ,
0 commit comments