Skip to content

Commit

Permalink
Rollup merge of rust-lang#105470 - flip1995:clippy_backport, r=Manish…
Browse files Browse the repository at this point in the history
…earth

Clippy: backport ICE fix before beta branch

r? `@Manishearth`

Before beta is branched tomorrow we should backport the fix from rust-lang/rust-clippy#10027 for an ICE. That way we'll get this into stable one release sooner.

This only cherry-picks the fix, not the tests for it. The proper sync of this will be done next week Thursday.
  • Loading branch information
matthiaskrgr committed Dec 9, 2022
2 parents 04dac42 + 3c29e74 commit 3e7aadc
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,12 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
Node::Expr(parent_expr) => {
if let Some((callee_def_id, call_substs, recv, call_args)) = get_callee_substs_and_args(cx, parent_expr)
{
if Some(callee_def_id) == cx.tcx.lang_items().into_future_fn() {
return false;
}

let fn_sig = cx.tcx.fn_sig(callee_def_id).skip_binder();
if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id)
&& let Some(param_ty) = fn_sig.inputs().get(arg_index)
&& let ty::Param(ParamTy { index: param_index , ..}) = param_ty.kind()
// https://github.com/rust-lang/rust-clippy/issues/9504 and https://github.com/rust-lang/rust-clippy/issues/10021
&& (*param_index as usize) < call_substs.len()
{
if fn_sig
.inputs()
Expand Down

0 comments on commit 3e7aadc

Please sign in to comment.