Skip to content

Wrong bindings_after_at warnings #67861

Closed
@leonardo-m

Description

@leonardo-m

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.F-bindings_after_at`#![feature(bindings_after_at)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions