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

async fn raises unused_mut on parameter that is used mutably #60566

Closed
Arnavion opened this issue May 5, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@Arnavion
Copy link

commented May 5, 2019

rustc 1.36.0-nightly (8dd4aae9a 2019-05-04)
binary: rustc
commit-hash: 8dd4aae9a83964cc08505da92d07ec68a3a2341d
commit-date: 2019-05-04
host: x86_64-pc-windows-msvc
release: 1.36.0-nightly
LLVM version: 8.0

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=4f2bb9f701bdbbb3424e926989bc0f2f

#![feature(async_await)]
#![deny(unused_mut)]

pub struct S;

pub async fn foo(mut s: S) {
    let _ = &mut s;
}

raises unused_mut on the s parameter of foo.

@taiki-e This is also raised in the test case you added in #60501, but I assume the test passes because it defaults to ignoring the warning.


Workaround:

-pub async fn foo(mut s: S) {
+pub async fn foo(s: S) {
+    let mut s = s;
     let _ = &mut s;
@jonas-schievink

This comment has been minimized.

Copy link
Member

commented May 5, 2019

Duplicate of #60498

@jonas-schievink jonas-schievink marked this as a duplicate of #60498 May 5, 2019

@Arnavion

This comment has been minimized.

Copy link
Author

commented May 5, 2019

@jonas-schievink Please read the issue carefully. Not only is it have a different issue from what #60498 was, I specifically linked to the PR that fixes #60498 with the intent of demonstrating that it's a different issue.

@jonas-schievink

This comment has been minimized.

Copy link
Member

commented May 5, 2019

Oops, sorry!

@taiki-e

This comment has been minimized.

Copy link
Contributor

commented May 6, 2019

@taiki-e This is also raised in the test case you added in #60501, but I assume the test passes because it defaults to ignoring the warning.

Yes, I missed the warnings being ignored. This will be fixed in #60535. Also, there are reports in #60509 about other errors missed in #60501.

Centril added a commit to Centril/rust that referenced this issue May 7, 2019

@bors bors closed this in #60535 May 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.