Skip to content

Closure incorrectly tries to move instead of borrow in ref patterns within if let #18201

Closed
@Veykril

Description

@Veykril
struct NotCopy;
struct S(NotCopy);
impl S {
    fn f(&mut self) {
        || {
            if let ref mut cb = self.0 {
            }
        };
    }
}

This incorrectly reports cannot move NotCopy out of reference. This closure is not actually moving the 0 field out.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions