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