@@ -212,7 +212,7 @@ pub trait TypeErrCtxtExt<'tcx> {
212212
213213 fn extract_callable_info (
214214 & self ,
215- hir_id : HirId ,
215+ body_id : LocalDefId ,
216216 param_env : ty:: ParamEnv < ' tcx > ,
217217 found : Ty < ' tcx > ,
218218 ) -> Option < ( DefIdOrName , Ty < ' tcx > , Vec < Ty < ' tcx > > ) > ;
@@ -909,9 +909,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
909909 trait_pred. self_ty ( ) ,
910910 ) ;
911911
912- let body_hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( obligation. cause . body_id ) ;
913912 let Some ( ( def_id_or_name, output, inputs) ) = self . extract_callable_info (
914- body_hir_id ,
913+ obligation . cause . body_id ,
915914 obligation. param_env ,
916915 self_ty,
917916 ) else { return false ; } ;
@@ -1113,10 +1112,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
11131112 /// Extracts information about a callable type for diagnostics. This is a
11141113 /// heuristic -- it doesn't necessarily mean that a type is always callable,
11151114 /// because the callable type must also be well-formed to be called.
1116- // FIXME(vincenzopalazzo): move the HirId to a LocalDefId
11171115 fn extract_callable_info (
11181116 & self ,
1119- hir_id : HirId ,
1117+ body_id : LocalDefId ,
11201118 param_env : ty:: ParamEnv < ' tcx > ,
11211119 found : Ty < ' tcx > ,
11221120 ) -> Option < ( DefIdOrName , Ty < ' tcx > , Vec < Ty < ' tcx > > ) > {
@@ -1168,7 +1166,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
11681166 } )
11691167 }
11701168 ty:: Param ( param) => {
1171- let generics = self . tcx . generics_of ( hir_id . owner . to_def_id ( ) ) ;
1169+ let generics = self . tcx . generics_of ( body_id ) ;
11721170 let name = if generics. count ( ) > param. index as usize
11731171 && let def = generics. param_at ( param. index as usize , self . tcx )
11741172 && matches ! ( def. kind, ty:: GenericParamDefKind :: Type { .. } )
0 commit comments