File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -151,9 +151,14 @@ impl<'tcx> LateLintPass<'tcx> for UselessConversion {
151
151
{
152
152
if let Some ( parent) = get_parent_expr ( cx, e) {
153
153
let parent_fn = match parent. kind {
154
- ExprKind :: Call ( recv, args) if let ExprKind :: Path ( ref qpath) = recv. kind => {
155
- cx. qpath_res ( qpath, recv. hir_id ) . opt_def_id ( )
156
- . map ( |did| ( did, args, MethodOrFunction :: Function ) )
154
+ ExprKind :: Call ( recv, args)
155
+ if let ExprKind :: Path ( ref qpath) = recv. kind
156
+ && let Some ( did) = cx. qpath_res ( qpath, recv. hir_id ) . opt_def_id ( )
157
+ // make sure that the path indeed points to a fn-like item, so that
158
+ // `fn_sig` does not ICE. (see #11065)
159
+ && cx. tcx . opt_def_kind ( did) . is_some_and ( |k| k. is_fn_like ( ) ) =>
160
+ {
161
+ Some ( ( did, args, MethodOrFunction :: Function ) )
157
162
}
158
163
ExprKind :: MethodCall ( .., args, _) => {
159
164
cx. typeck_results ( ) . type_dependent_def_id ( parent. hir_id )
You can’t perform that action at this time.
0 commit comments