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 · Fixed by #60535
Closed

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

Arnavion opened this issue May 5, 2019 · 4 comments · Fixed by #60535
Labels
A-async-await Area: Async & Await A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Arnavion
Copy link

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
Contributor

Duplicate of #60498

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

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
Contributor

Oops, sorry!

@jonas-schievink jonas-schievink added A-async-await Area: Async & Await A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 5, 2019
@taiki-e
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants