Skip to content

Commit

Permalink
compiler: Lower fn call arg spans down to MIR
Browse files Browse the repository at this point in the history
To enable improved accuracy of diagnostics in upcoming commits.
  • Loading branch information
Enselic committed Jan 15, 2024
1 parent 5a45dbe commit 6a74a0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ fn is_call_with_ref_arg<'tcx>(
..
} = kind
&& args.len() == 1
&& let mir::Operand::Move(mir::Place { local, .. }) = &args[0]
&& let mir::Operand::Move(mir::Place { local, .. }) = &args[0].node
&& let ty::FnDef(def_id, _) = *func.ty(mir, cx.tcx).kind()
&& let (inner_ty, 1) = walk_ptrs_ty_depth(args[0].ty(mir, cx.tcx))
&& let (inner_ty, 1) = walk_ptrs_ty_depth(args[0].node.ty(mir, cx.tcx))
&& !is_copy(cx, inner_ty)
{
Some((def_id, *local, inner_ty, destination.as_local()?))
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/mir/possible_borrower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<'a, 'b, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'b,
let mut mutable_borrowers = vec![];

for op in args {
match op {
match &op.node {
mir::Operand::Copy(p) | mir::Operand::Move(p) => {
if let ty::Ref(_, _, Mutability::Mut) = self.body.local_decls[p.local].ty.kind() {
mutable_borrowers.push(p.local);
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ fn check_terminator<'tcx>(
check_operand(tcx, func, span, body)?;

for arg in args {
check_operand(tcx, arg, span, body)?;
check_operand(tcx, &arg.node, span, body)?;
}
Ok(())
} else {
Expand Down

0 comments on commit 6a74a0e

Please sign in to comment.