@@ -10,7 +10,7 @@ use rustc_middle::mir::ConstraintCategory;
10
10
use rustc_middle:: traits:: query:: OutlivesBound ;
11
11
use rustc_middle:: traits:: ObligationCause ;
12
12
use rustc_middle:: ty:: { self , RegionVid , Ty , TypeVisitableExt } ;
13
- use rustc_span:: { ErrorGuaranteed , DUMMY_SP } ;
13
+ use rustc_span:: { ErrorGuaranteed , Span } ;
14
14
use rustc_trait_selection:: solve:: deeply_normalize;
15
15
use rustc_trait_selection:: traits:: error_reporting:: TypeErrCtxtExt ;
16
16
use rustc_trait_selection:: traits:: query:: type_op:: { self , TypeOp } ;
@@ -269,7 +269,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
269
269
debug ! ( "build: input_or_output={:?}" , ty) ;
270
270
// We add implied bounds from both the unnormalized and normalized ty.
271
271
// See issue #87748
272
- let constraints_unnorm = self . add_implied_bounds ( ty) ;
272
+ let constraints_unnorm = self . add_implied_bounds ( ty, span ) ;
273
273
if let Some ( c) = constraints_unnorm {
274
274
constraints. push ( c)
275
275
}
@@ -299,7 +299,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
299
299
// ```
300
300
// Both &Self::Bar and &() are WF
301
301
if ty != norm_ty {
302
- let constraints_norm = self . add_implied_bounds ( norm_ty) ;
302
+ let constraints_norm = self . add_implied_bounds ( norm_ty, span ) ;
303
303
if let Some ( c) = constraints_norm {
304
304
constraints. push ( c)
305
305
}
@@ -323,7 +323,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
323
323
324
324
// We currently add implied bounds from the normalized ty only.
325
325
// This is more conservative and matches wfcheck behavior.
326
- let c = self . add_implied_bounds ( norm_ty) ;
326
+ let c = self . add_implied_bounds ( norm_ty, span ) ;
327
327
constraints. extend ( c) ;
328
328
}
329
329
}
@@ -361,11 +361,15 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
361
361
/// the same time, compute and add any implied bounds that come
362
362
/// from this local.
363
363
#[ instrument( level = "debug" , skip( self ) ) ]
364
- fn add_implied_bounds ( & mut self , ty : Ty < ' tcx > ) -> Option < & ' tcx QueryRegionConstraints < ' tcx > > {
364
+ fn add_implied_bounds (
365
+ & mut self ,
366
+ ty : Ty < ' tcx > ,
367
+ span : Span ,
368
+ ) -> Option < & ' tcx QueryRegionConstraints < ' tcx > > {
365
369
let TypeOpOutput { output : bounds, constraints, .. } = self
366
370
. param_env
367
371
. and ( type_op:: implied_outlives_bounds:: ImpliedOutlivesBounds { ty } )
368
- . fully_perform ( self . infcx , DUMMY_SP )
372
+ . fully_perform ( self . infcx , span )
369
373
. map_err ( |_: ErrorGuaranteed | debug ! ( "failed to compute implied bounds {:?}" , ty) )
370
374
. ok ( ) ?;
371
375
debug ! ( ?bounds, ?constraints) ;
0 commit comments