@@ -30,7 +30,7 @@ use crate::diagnostics::RegionErrors;
30
30
use crate :: facts:: { AllFacts , AllFactsExt , RustcFacts } ;
31
31
use crate :: location:: LocationTable ;
32
32
use crate :: region_infer:: RegionInferenceContext ;
33
- use crate :: type_check:: { self , MirTypeckRegionConstraints , MirTypeckResults } ;
33
+ use crate :: type_check:: { self , MirTypeckResults } ;
34
34
use crate :: universal_regions:: UniversalRegions ;
35
35
use crate :: { BorrowckInferCtxt , polonius, renumber} ;
36
36
@@ -50,10 +50,9 @@ pub(crate) struct NllOutput<'tcx> {
50
50
/// Rewrites the regions in the MIR to use NLL variables, also scraping out the set of universal
51
51
/// regions (e.g., region parameters) declared on the function. That set will need to be given to
52
52
/// `compute_regions`.
53
- #[ instrument( skip( infcx, param_env , body, promoted) , level = "debug" ) ]
53
+ #[ instrument( skip( infcx, body, promoted) , level = "debug" ) ]
54
54
pub ( crate ) fn replace_regions_in_mir < ' tcx > (
55
55
infcx : & BorrowckInferCtxt < ' tcx > ,
56
- param_env : ty:: ParamEnv < ' tcx > ,
57
56
body : & mut Body < ' tcx > ,
58
57
promoted : & mut IndexSlice < Promoted , Body < ' tcx > > ,
59
58
) -> UniversalRegions < ' tcx > {
@@ -62,7 +61,7 @@ pub(crate) fn replace_regions_in_mir<'tcx>(
62
61
debug ! ( ?def) ;
63
62
64
63
// Compute named region information. This also renumbers the inputs/outputs.
65
- let universal_regions = UniversalRegions :: new ( infcx, def, param_env ) ;
64
+ let universal_regions = UniversalRegions :: new ( infcx, def) ;
66
65
67
66
// Replace all remaining regions with fresh inference variables.
68
67
renumber:: renumber_mir ( infcx, body, promoted) ;
@@ -81,11 +80,9 @@ pub(crate) fn compute_regions<'a, 'tcx>(
81
80
body : & Body < ' tcx > ,
82
81
promoted : & IndexSlice < Promoted , Body < ' tcx > > ,
83
82
location_table : & LocationTable ,
84
- param_env : ty:: ParamEnv < ' tcx > ,
85
- flow_inits : & mut ResultsCursor < ' a , ' tcx , MaybeInitializedPlaces < ' a , ' tcx > > ,
83
+ flow_inits : ResultsCursor < ' a , ' tcx , MaybeInitializedPlaces < ' a , ' tcx > > ,
86
84
move_data : & MoveData < ' tcx > ,
87
85
borrow_set : & BorrowSet < ' tcx > ,
88
- upvars : & [ & ty:: CapturedPlace < ' tcx > ] ,
89
86
consumer_options : Option < ConsumerOptions > ,
90
87
) -> NllOutput < ' tcx > {
91
88
let is_polonius_legacy_enabled = infcx. tcx . sess . opts . unstable_opts . polonius . is_legacy_enabled ( ) ;
@@ -96,41 +93,27 @@ pub(crate) fn compute_regions<'a, 'tcx>(
96
93
let mut all_facts =
97
94
( polonius_input || AllFacts :: enabled ( infcx. tcx ) ) . then_some ( AllFacts :: default ( ) ) ;
98
95
99
- let universal_regions = Rc :: new ( universal_regions) ;
100
-
101
96
let elements = Rc :: new ( DenseLocationMap :: new ( body) ) ;
102
97
103
98
// Run the MIR type-checker.
104
99
let MirTypeckResults { constraints, universal_region_relations, opaque_type_values } =
105
100
type_check:: type_check (
106
101
infcx,
107
- param_env,
108
102
body,
109
103
promoted,
110
- Rc :: clone ( & universal_regions) ,
104
+ universal_regions,
111
105
location_table,
112
106
borrow_set,
113
107
& mut all_facts,
114
108
flow_inits,
115
109
move_data,
116
110
Rc :: clone ( & elements) ,
117
- upvars,
118
111
) ;
119
112
120
113
// Create the region inference context, taking ownership of the
121
114
// region inference data that was contained in `infcx`, and the
122
115
// base constraints generated by the type-check.
123
116
let var_origins = infcx. get_region_var_origins ( ) ;
124
- let MirTypeckRegionConstraints {
125
- placeholder_indices,
126
- placeholder_index_to_region : _,
127
- liveness_constraints,
128
- mut outlives_constraints,
129
- mut member_constraints,
130
- universe_causes,
131
- type_tests,
132
- } = constraints;
133
- let placeholder_indices = Rc :: new ( placeholder_indices) ;
134
117
135
118
// If requested, emit legacy polonius facts.
136
119
polonius:: emit_facts (
@@ -140,31 +123,14 @@ pub(crate) fn compute_regions<'a, 'tcx>(
140
123
body,
141
124
borrow_set,
142
125
move_data,
143
- & universal_regions,
144
126
& universal_region_relations,
145
127
) ;
146
128
147
- if let Some ( guar) = universal_regions. tainted_by_errors ( ) {
148
- // Suppress unhelpful extra errors in `infer_opaque_types` by clearing out all
149
- // outlives bounds that we may end up checking.
150
- outlives_constraints = Default :: default ( ) ;
151
- member_constraints = Default :: default ( ) ;
152
-
153
- // Also taint the entire scope.
154
- infcx. set_tainted_by_errors ( guar) ;
155
- }
156
-
157
129
let mut regioncx = RegionInferenceContext :: new (
158
130
infcx,
159
131
var_origins,
160
- universal_regions,
161
- placeholder_indices,
132
+ constraints,
162
133
universal_region_relations,
163
- outlives_constraints,
164
- member_constraints,
165
- universe_causes,
166
- type_tests,
167
- liveness_constraints,
168
134
elements,
169
135
) ;
170
136
0 commit comments