@@ -10,7 +10,7 @@ use rustc_middle::mir::ConstraintCategory;
1010use rustc_middle:: traits:: query:: OutlivesBound ;
1111use rustc_middle:: traits:: ObligationCause ;
1212use rustc_middle:: ty:: { self , RegionVid , Ty , TypeVisitableExt } ;
13- use rustc_span:: { ErrorGuaranteed , DUMMY_SP } ;
13+ use rustc_span:: { ErrorGuaranteed , Span } ;
1414use rustc_trait_selection:: solve:: deeply_normalize;
1515use rustc_trait_selection:: traits:: error_reporting:: TypeErrCtxtExt ;
1616use rustc_trait_selection:: traits:: query:: type_op:: { self , TypeOp } ;
@@ -269,7 +269,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
269269 debug ! ( "build: input_or_output={:?}" , ty) ;
270270 // We add implied bounds from both the unnormalized and normalized ty.
271271 // See issue #87748
272- let constraints_unnorm = self . add_implied_bounds ( ty) ;
272+ let constraints_unnorm = self . add_implied_bounds ( ty, span ) ;
273273 if let Some ( c) = constraints_unnorm {
274274 constraints. push ( c)
275275 }
@@ -299,7 +299,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
299299 // ```
300300 // Both &Self::Bar and &() are WF
301301 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 ) ;
303303 if let Some ( c) = constraints_norm {
304304 constraints. push ( c)
305305 }
@@ -323,7 +323,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
323323
324324 // We currently add implied bounds from the normalized ty only.
325325 // 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 ) ;
327327 constraints. extend ( c) ;
328328 }
329329 }
@@ -361,11 +361,15 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
361361 /// the same time, compute and add any implied bounds that come
362362 /// from this local.
363363 #[ 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 > > {
365369 let TypeOpOutput { output : bounds, constraints, .. } = self
366370 . param_env
367371 . and ( type_op:: implied_outlives_bounds:: ImpliedOutlivesBounds { ty } )
368- . fully_perform ( self . infcx , DUMMY_SP )
372+ . fully_perform ( self . infcx , span )
369373 . map_err ( |_: ErrorGuaranteed | debug ! ( "failed to compute implied bounds {:?}" , ty) )
370374 . ok ( ) ?;
371375 debug ! ( ?bounds, ?constraints) ;
0 commit comments