Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in checking for unneccessary mutable references #114405

Closed
davidv1992 opened this issue Aug 3, 2023 · 3 comments
Closed

Regression in checking for unneccessary mutable references #114405

davidv1992 opened this issue Aug 3, 2023 · 3 comments
Labels
A-clippy Area: Clippy C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@davidv1992
Copy link
Contributor

Code

Checking the github.com/pendulum-project/statime repository with cargo clippy on nightly-2023-08-02 finds two warnings for unneeded mutable references. One of these is genuine, but the other is a false alarm.

Output:

warning: this argument is a mutable reference, but not used mutably
  --> statime-linux/src/network/timestamped_udp_socket.rs:36:55
   |
36 |     pub async fn recv(&self, clock: &LinuxClock, buf: &mut [u8]) -> std::io::Result<RecvResult> {
   |                                                       ^^^^^^^^^ help: consider changing to: `&[u8]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
   = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default

warning: `statime-linux` (lib) generated 1 warning
warning: this argument is a mutable reference, but not used mutably
   --> statime-linux/src/main.rs:341:18
    |
341 |     local_clock: &mut LinuxClock,
    |                  ^^^^^^^^^^^^^^^ help: consider changing to: `&LinuxClock`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
    = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default

warning: `statime-linux` (bin "statime-linux") generated 1 warning

of these, the warning on recv is the false alarm (the mut is very much needed on that function, as one would expect for a function called recv)

Version it worked on

rustc +nightly-2023-08-01 --version --verbose:

rustc 1.73.0-nightly (db7ff98a7 2023-07-31)
binary: rustc
commit-hash: db7ff98a72f3e742b641f9cb16d0e8c285e87e9b
commit-date: 2023-07-31
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Version with regression

rustc +nightly-2023-08-02 --version --verbose:

rustc 1.73.0-nightly (d12c6e947 2023-08-01)
binary: rustc
commit-hash: d12c6e947ceacf3b22c154caf9532b390d8dc88a
commit-date: 2023-08-01
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

@davidv1992 davidv1992 added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Aug 3, 2023
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-untriaged Untriaged performance or correctness regression. labels Aug 3, 2023
@apiraino
Copy link
Contributor

apiraino commented Aug 3, 2023

without bisecting I sense this change rust-clippy#11226 is the cause

@rustbot label +A-clippy

@rustbot rustbot added the A-clippy Area: Clippy label Aug 3, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 4, 2023
@GuillaumeGomez
Copy link
Member

The equivalent issue was in clippy (rust-lang/rust-clippy#11179) and was fixed in rust-lang/rust-clippy#11184. If the bug still exists, please open the issue on clippy.

@GuillaumeGomez
Copy link
Member

Just thinking, if there is an async block, then you'll have to wait for rust-lang/rust-clippy#11314 to be merged to be this fixed.

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clippy Area: Clippy C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

No branches or pull requests

5 participants