ptr lint: check_mut_from_ref is checked independently of the function's ABI

This commit is contained in:
Milo Moisson 2023-07-24 01:23:35 +02:00
parent 30d06a810c
commit 7b8598d6c0
No known key found for this signature in database
GPG Key ID: 7EA9B7563C01CA5E

View File

@ -163,12 +163,13 @@ fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'_>
return;
}
check_mut_from_ref(cx, sig, None);
if !matches!(sig.header.abi, Abi::Rust) {
// Ignore `extern` functions with non-Rust calling conventions
return;
}
check_mut_from_ref(cx, sig, None);
for arg in check_fn_args(
cx,
cx.tcx.fn_sig(item.owner_id).subst_identity().skip_binder().inputs(),
@ -223,12 +224,13 @@ fn check_body(&mut self, cx: &LateContext<'tcx>, body: &'tcx Body<'_>) {
_ => return,
};
check_mut_from_ref(cx, sig, Some(body));
if !matches!(sig.header.abi, Abi::Rust) {
// Ignore `extern` functions with non-Rust calling conventions
return;
}
check_mut_from_ref(cx, sig, Some(body));
let decl = sig.decl;
let sig = cx.tcx.fn_sig(item_id).subst_identity().skip_binder();
let lint_args: Vec<_> = check_fn_args(cx, sig.inputs(), decl.inputs, &decl.output, body.params)