Skip to content

nll: incorrect unused_mut with move closure #51801

Closed
@kazcw

Description

@kazcw

With the nll feature enabled, a "variable does not need to be mutable" warning is emitted incorrectly when a variable is mutated from inside a move closure.

#![feature(nll)]

fn main() {
    let mut baz = 4; // "warning: variable does not need to be mutable"
    move || { baz = 6 };
}   

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)C-enhancementCategory: An issue proposing an enhancement or a PR with one.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