Skip to content

Incorrect closure capture analysis #20155

@Veykril

Description

@Veykril
        let b = Some(Box::new(0));
        || {
            if let Some(b) = b {
                let _move = b;
            }
        };

we incorrectly report an error on the move of b here. We capture b by reference, then complain we can't move it. We should be capturing it by value.

Metadata

Metadata

Assignees

Labels

A-tytype system / type inference / traits / method resolutionC-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions