@@ -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
@@ -771,7 +779,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
771779 self . register_wf_obligation (
772780 ty. raw . into ( ) ,
773781 qself. span ,
774- ObligationCauseCode :: WellFormed ( None ) ,
782+ ObligationCauseCode :: WellFormed ( Some ( traits :: WellFormedLoc :: Expr ( hir_id ) ) ) ,
775783 ) ;
776784 // Return directly on cache hit. This is useful to avoid doubly reporting
777785 // errors with default match binding modes. See #44614.
@@ -811,7 +819,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
811819 self . register_wf_obligation (
812820 ty. raw . into ( ) ,
813821 qself. span ,
814- ObligationCauseCode :: WellFormed ( None ) ,
822+ ObligationCauseCode :: WellFormed ( Some ( traits :: WellFormedLoc :: Expr ( hir_id ) ) ) ,
815823 ) ;
816824 }
817825
@@ -849,7 +857,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
849857 self . register_wf_obligation (
850858 ty. raw . into ( ) ,
851859 qself. span ,
852- ObligationCauseCode :: WellFormed ( None ) ,
860+ ObligationCauseCode :: WellFormed ( Some ( traits :: WellFormedLoc :: Expr ( hir_id ) ) ) ,
853861 ) ;
854862 }
855863
0 commit comments