Skip to content

Closure capture calculated incorrectly for non-binding match #14754

Closed
@Veykril

Description

@Veykril

The following closures capture x by value both
playground

fn main() {
    let c: fn() = {
        let x = 1;
        || {
            let _ = x;
        }
    };
    let c: fn() = {
        let x = 1;
        || match x {
            _ => println!("Hello World!"),
        }
    };
}

yet we recognize the first as non capturing and the second as capturing by ref.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions