Skip to content

Incorrect unused mut warning in 1.46.0-nightly (f455e46ea 2020-06-20) #73592

@dignifiedquire

Description

@dignifiedquire

CI on https://github.com/async-rs/async-std suddenly started failing as we run with deny warnings.

the error is

error: variable does not need to be mutable ##[error] --> src/io/stderr.rs:92:9 | 92 | mut self: Pin<&mut Self>, | ----^^^^ | | | help: remove this `mut` | = note: `-D unused-mut` implied by `-D warnings` error: variable does not need to be mutable 

for the following code

impl Write for Stderr { fn poll_write( mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<io::Result<usize>> { let state = &mut *self.0.lock().unwrap(); // ...  }

which stops compiling if the referenced mut is removed.

(Sorry in advance if this is known, but I couldn't find a matching issue)

CI run: https://github.com/async-rs/async-std/pull/822/checks?check_run_id=793134400
Source Code: https://github.com/async-rs/async-std/blob/master/src/io/stderr.rs#L90-L96

Edit: It seems that the nightly version might not be what triggered it, but rather a change in the underlying implementation of the lock that is being called above.

No warnings under

  • rustc 1.45.0-nightly (1836e3b 2020-05-06)
  • rustc 1.44.1 (c7087fe 2020-06-17)

This issue has been assigned to @nbdd0121 via this comment.

Metadata

Metadata

Assignees

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.ICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisections

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions