7
7
//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
8
8
//! contain revealed `impl Trait` values).
9
9
10
- use crate :: type_check:: constraint_conversion:: ConstraintConversion ;
11
10
use rustc_index:: vec:: Idx ;
12
11
use rustc_infer:: infer:: LateBoundRegionConversionTime ;
13
12
use rustc_middle:: mir:: * ;
14
13
use rustc_middle:: ty:: Ty ;
15
14
use rustc_span:: Span ;
16
- use rustc_span:: DUMMY_SP ;
17
- use rustc_trait_selection:: traits:: query:: type_op:: { self , TypeOp } ;
18
- use rustc_trait_selection:: traits:: query:: Fallible ;
19
- use type_op:: TypeOpOutput ;
20
15
21
16
use crate :: universal_regions:: UniversalRegions ;
22
17
@@ -185,7 +180,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
185
180
}
186
181
}
187
182
188
- #[ instrument( skip( self , span ) , level = "debug" ) ]
183
+ #[ instrument( skip( self ) , level = "debug" ) ]
189
184
fn equate_normalized_input_or_output ( & mut self , a : Ty < ' tcx > , b : Ty < ' tcx > , span : Span ) {
190
185
if let Err ( _) =
191
186
self . eq_types ( a, b, Locations :: All ( span) , ConstraintCategory :: BoringNoLocation )
@@ -194,13 +189,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
194
189
// `rustc_traits::normalize_after_erasing_regions`. Ideally, we'd
195
190
// like to normalize *before* inserting into `local_decls`, but
196
191
// doing so ends up causing some other trouble.
197
- let b = match self . normalize_and_add_constraints ( b) {
198
- Ok ( n) => n,
199
- Err ( _) => {
200
- debug ! ( "equate_inputs_and_outputs: NoSolution" ) ;
201
- b
202
- }
203
- } ;
192
+ let b = self . normalize ( b, Locations :: All ( span) ) ;
204
193
205
194
// Note: if we have to introduce new placeholders during normalization above, then we won't have
206
195
// added those universes to the universe info, which we would want in `relate_tys`.
@@ -218,28 +207,4 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
218
207
}
219
208
}
220
209
}
221
-
222
- pub ( crate ) fn normalize_and_add_constraints ( & mut self , t : Ty < ' tcx > ) -> Fallible < Ty < ' tcx > > {
223
- let TypeOpOutput { output : norm_ty, constraints, .. } =
224
- self . param_env . and ( type_op:: normalize:: Normalize :: new ( t) ) . fully_perform ( self . infcx ) ?;
225
-
226
- debug ! ( "{:?} normalized to {:?}" , t, norm_ty) ;
227
-
228
- for data in constraints {
229
- ConstraintConversion :: new (
230
- self . infcx ,
231
- & self . borrowck_context . universal_regions ,
232
- & self . region_bound_pairs ,
233
- self . implicit_region_bound ,
234
- self . param_env ,
235
- Locations :: All ( DUMMY_SP ) ,
236
- DUMMY_SP ,
237
- ConstraintCategory :: Internal ,
238
- & mut self . borrowck_context . constraints ,
239
- )
240
- . convert_all ( & * data) ;
241
- }
242
-
243
- Ok ( norm_ty)
244
- }
245
210
}
0 commit comments