@@ -5,13 +5,14 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
5
5
use rustc_infer:: infer:: outlives:: env:: RegionBoundPairs ;
6
6
use rustc_infer:: infer:: region_constraints:: GenericKind ;
7
7
use rustc_infer:: infer:: { InferCtxt , outlives} ;
8
+ use rustc_infer:: traits:: ScrubbedTraitError ;
8
9
use rustc_middle:: mir:: ConstraintCategory ;
9
10
use rustc_middle:: traits:: ObligationCause ;
10
11
use rustc_middle:: traits:: query:: OutlivesBound ;
11
12
use rustc_middle:: ty:: { self , RegionVid , Ty , TypeVisitableExt } ;
12
13
use rustc_span:: { ErrorGuaranteed , Span } ;
13
- use rustc_trait_selection:: error_reporting :: InferCtxtErrorExt ;
14
- use rustc_trait_selection:: solve :: deeply_normalize ;
14
+ use rustc_trait_selection:: solve :: NoSolution ;
15
+ use rustc_trait_selection:: traits :: query :: type_op :: custom :: CustomTypeOp ;
15
16
use rustc_trait_selection:: traits:: query:: type_op:: { self , TypeOp } ;
16
17
use tracing:: { debug, instrument} ;
17
18
use type_op:: TypeOpOutput ;
@@ -233,16 +234,29 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
233
234
234
235
// In the new solver, normalize the type-outlives obligation assumptions.
235
236
if self . infcx . next_trait_solver ( ) {
236
- match deeply_normalize (
237
- self . infcx . at ( & ObligationCause :: misc ( span, defining_ty_def_id) , param_env) ,
238
- outlives,
239
- ) {
240
- Ok ( normalized_outlives) => {
241
- outlives = normalized_outlives;
242
- }
243
- Err ( e) => {
244
- self . infcx . err_ctxt ( ) . report_fulfillment_errors ( e) ;
245
- }
237
+ let Ok ( TypeOpOutput {
238
+ output : normalized_outlives,
239
+ constraints : constraints_normalize,
240
+ error_info : _,
241
+ } ) = CustomTypeOp :: new (
242
+ |ocx| {
243
+ ocx. deeply_normalize (
244
+ & ObligationCause :: dummy_with_span ( span) ,
245
+ self . param_env ,
246
+ outlives,
247
+ )
248
+ . map_err ( |_: Vec < ScrubbedTraitError < ' tcx > > | NoSolution )
249
+ } ,
250
+ "normalize type outlives obligation" ,
251
+ )
252
+ . fully_perform ( self . infcx , span)
253
+ else {
254
+ self . infcx . dcx ( ) . delayed_bug ( format ! ( "could not normalize {outlives:?}" ) ) ;
255
+ continue ;
256
+ } ;
257
+ outlives = normalized_outlives;
258
+ if let Some ( c) = constraints_normalize {
259
+ constraints. push ( c) ;
246
260
}
247
261
}
248
262
0 commit comments