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

Wrong bindings_after_at warnings #67861

Closed
leonardo-m opened this issue Jan 4, 2020 · 1 comment · Fixed by #68992
Closed

Wrong bindings_after_at warnings #67861

leonardo-m opened this issue Jan 4, 2020 · 1 comment · Fixed by #68992
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-bindings_after_at `#![feature(bindings_after_at)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@leonardo-m
Copy link

leonardo-m commented Jan 4, 2020

Here I use the bindings_after_at feature, I need the sub-bindings to be immutable, but I want to mutate the whole tuple variable:

#![feature(bindings_after_at)]
fn main() {
    let mut xy @ (x, y) = (10, 20);
    println!("{} {}", x, y);
    println!("{:?}", xy);
    xy = (30, 40);
    println!("{:?}", xy);
}

It gives wrong warnings:

warning: variable does not need to be mutable
 --> ...\test.rs:3:19
  |
3 |     let mut xy @ (x, y) = (10, 20);
  |                   ^ help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

warning: variable does not need to be mutable
 --> ...\test.rs:3:22
  |
3 |     let mut xy @ (x, y) = (10, 20);
  |                      ^ help: remove this `mut`
@jonas-schievink jonas-schievink added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-bindings_after_at `#![feature(bindings_after_at)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 4, 2020
@Centril
Copy link
Contributor

Centril commented Jan 6, 2020

Related: #67926

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-bindings_after_at `#![feature(bindings_after_at)]` 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