Skip to content

[NLL] Should this code compile with NLL? #67201

@quixoticaxis

Description

@quixoticaxis

Here's the code:

fn main() {
    let mut v = vec![1, 2, 3];
    v.swap(0, v.iter().position(|num| *num == 3).unwrap());
}

Should this code compile? And what is the right place to ask questions about it?
I've got here following some awesome rustaceans' advises to read this RFC and then this tracking issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions