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
Closed

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

Arnavion opened this issue May 5, 2019 · 4 comments

Comments

@Arnavion
Copy link

@Arnavion Arnavion 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
Copy link
Member

@jonas-schievink jonas-schievink commented May 5, 2019

Duplicate of #60498

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

@Arnavion Arnavion 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
Copy link
Member

@jonas-schievink jonas-schievink commented May 5, 2019

Oops, sorry!

@taiki-e
Copy link
Member

@taiki-e taiki-e 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
Correct handling of arguments in async fn

Fixes rust-lang#60509
Fixes rust-lang#60566

r? @cramertj or @davidtwco
@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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants