Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive on moved out of ref diagnostic #15787

Closed
ronnodas opened this issue Oct 21, 2023 · 3 comments · Fixed by #15789
Closed

False positive on moved out of ref diagnostic #15787

ronnodas opened this issue Oct 21, 2023 · 3 comments · Fixed by #15789
Assignees
Labels
A-diagnostics diagnostics / error reporting A-mir C-bug Category: bug

Comments

@ronnodas
Copy link

ronnodas commented Oct 21, 2023

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

@ronnodas ronnodas added the C-bug Category: bug label Oct 21, 2023
@HKalbasi HKalbasi self-assigned this Oct 22, 2023
@HKalbasi
Copy link
Member

"rust-analyzer.diagnostics.experimental.enable": false Is this correct?

@lnicola
Copy link
Member

lnicola commented Oct 22, 2023

I can reproduce it only with experimental diagnostics enabled.

@lnicola lnicola added A-diagnostics diagnostics / error reporting A-mir labels Oct 22, 2023
@ronnodas
Copy link
Author

Sorry, I tried with experimental diagnostics both enabled and disabled and maybe it was some kind of caching or settings syncing issue. I too can only reproduce it with that setting enabled now, so edited the original post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting A-mir C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants