Wrong bindings_after_at warnings · Issue #67861 · rust-lang/rust (original) (raw)

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`