@@ -212,7 +212,7 @@ pub trait TypeErrCtxtExt<'tcx> {
212
212
213
213
fn extract_callable_info (
214
214
& self ,
215
- hir_id : HirId ,
215
+ body_id : LocalDefId ,
216
216
param_env : ty:: ParamEnv < ' tcx > ,
217
217
found : Ty < ' tcx > ,
218
218
) -> Option < ( DefIdOrName , Ty < ' tcx > , Vec < Ty < ' tcx > > ) > ;
@@ -909,9 +909,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
909
909
trait_pred. self_ty ( ) ,
910
910
) ;
911
911
912
- let body_hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( obligation. cause . body_id ) ;
913
912
let Some ( ( def_id_or_name, output, inputs) ) = self . extract_callable_info (
914
- body_hir_id ,
913
+ obligation . cause . body_id ,
915
914
obligation. param_env ,
916
915
self_ty,
917
916
) else { return false ; } ;
@@ -1113,10 +1112,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
1113
1112
/// Extracts information about a callable type for diagnostics. This is a
1114
1113
/// heuristic -- it doesn't necessarily mean that a type is always callable,
1115
1114
/// because the callable type must also be well-formed to be called.
1116
- // FIXME(vincenzopalazzo): move the HirId to a LocalDefId
1117
1115
fn extract_callable_info (
1118
1116
& self ,
1119
- hir_id : HirId ,
1117
+ body_id : LocalDefId ,
1120
1118
param_env : ty:: ParamEnv < ' tcx > ,
1121
1119
found : Ty < ' tcx > ,
1122
1120
) -> Option < ( DefIdOrName , Ty < ' tcx > , Vec < Ty < ' tcx > > ) > {
@@ -1168,7 +1166,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
1168
1166
} )
1169
1167
}
1170
1168
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 ) ;
1172
1170
let name = if generics. count ( ) > param. index as usize
1173
1171
&& let def = generics. param_at ( param. index as usize , self . tcx )
1174
1172
&& matches ! ( def. kind, ty:: GenericParamDefKind :: Type { .. } )
0 commit comments