@@ -405,7 +405,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
405405
406406 pub fn lower_ty ( & self , hir_ty : & hir:: Ty < ' tcx > ) -> LoweredTy < ' tcx > {
407407 let ty = self . lowerer ( ) . lower_ty ( hir_ty) ;
408- self . register_wf_obligation ( ty. into ( ) , hir_ty. span , ObligationCauseCode :: WellFormed ( None ) ) ;
408+ self . register_wf_obligation (
409+ ty. into ( ) ,
410+ hir_ty. span ,
411+ ObligationCauseCode :: WellFormed ( Some ( traits:: WellFormedLoc :: Expr ( hir_ty. hir_id ) ) ) ,
412+ ) ;
409413 LoweredTy :: from_raw ( self , hir_ty. span , ty)
410414 }
411415
@@ -516,7 +520,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
516520 for arg in args. iter ( ) . filter ( |arg| {
517521 matches ! ( arg. unpack( ) , GenericArgKind :: Type ( ..) | GenericArgKind :: Const ( ..) )
518522 } ) {
519- self . register_wf_obligation ( arg, expr. span , ObligationCauseCode :: WellFormed ( None ) ) ;
523+ self . register_wf_obligation (
524+ arg,
525+ expr. span ,
526+ ObligationCauseCode :: WellFormed ( Some ( traits:: WellFormedLoc :: Expr ( expr. hir_id ) ) ) ,
527+ ) ;
520528 }
521529 }
522530
@@ -770,7 +778,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
770778 self . register_wf_obligation (
771779 ty. raw . into ( ) ,
772780 qself. span ,
773- ObligationCauseCode :: WellFormed ( None ) ,
781+ ObligationCauseCode :: WellFormed ( Some ( traits :: WellFormedLoc :: Expr ( hir_id ) ) ) ,
774782 ) ;
775783 // Return directly on cache hit. This is useful to avoid doubly reporting
776784 // errors with default match binding modes. See #44614.
@@ -810,7 +818,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
810818 self . register_wf_obligation (
811819 ty. raw . into ( ) ,
812820 qself. span ,
813- ObligationCauseCode :: WellFormed ( None ) ,
821+ ObligationCauseCode :: WellFormed ( Some ( traits :: WellFormedLoc :: Expr ( hir_id ) ) ) ,
814822 ) ;
815823 }
816824
@@ -844,7 +852,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
844852 self . register_wf_obligation (
845853 ty. raw . into ( ) ,
846854 qself. span ,
847- ObligationCauseCode :: WellFormed ( None ) ,
855+ ObligationCauseCode :: WellFormed ( Some ( traits :: WellFormedLoc :: Expr ( hir_id ) ) ) ,
848856 ) ;
849857 }
850858
0 commit comments