Skip to content

False positive on moved out of ref diagnostic #15787

@ronnodas

Description

@ronnodas

The following code compiles fine (playground link) but rust-analyzer thinks it's moving a [u32] out of a reference (E0507):

fn foo(mut slice: &[u32]) -> usize {
    slice = match slice {
        [0, rest @ ..] | rest => rest,
    };
    slice.len()
}

rust-analyzer version: 0.3.1697-standalone

rustc version: rustc 1.73.0 (cc66ad468 2023-10-03)

relevant settings: "rust-analyzer.diagnostics.enable": true, "rust-analyzer.diagnostics.experimental.enable": true

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions