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

Incorrect "cannot move &mut () out of reference" error #16564

Open
Veykril opened this issue Feb 14, 2024 · 5 comments · May be fixed by #16870
Open

Incorrect "cannot move &mut () out of reference" error #16564

Veykril opened this issue Feb 14, 2024 · 5 comments · May be fixed by #16870
Labels
A-mir C-bug Category: bug

Comments

@Veykril
Copy link
Member

Veykril commented Feb 14, 2024

fn main() {
    let x = (&(&mut (),)).0 as *const ();
}

This compiles

@Veykril Veykril added C-bug Category: bug A-mir labels Feb 14, 2024
@ShoyuVanilla
Copy link
Contributor

Does this still occur? It seems somehow fixed - rust-analyzer 1.78.0-nightly (3b1717c0 2024-03-10), rust-analyzer 1.76.0 (07dca489 2024-02-04)

@Veykril
Copy link
Member Author

Veykril commented Mar 11, 2024

Still reproduces for me

@ShoyuVanilla
Copy link
Contributor

Thank you. I'll test again with different settings 🤔

@Veykril
Copy link
Member Author

Veykril commented Mar 11, 2024

Ah you need to enable experimental diagnostics for this one I think https://github.com/veykril/rust-analyzer/blob/0931361b8f6e3d02efb638cd9964c8817f59210a/crates/ide-diagnostics/src/handlers/moved_out_of_ref.rs#L14

@ShoyuVanilla
Copy link
Contributor

Oh, didn't know that 😅 Thanks!

@ShoyuVanilla ShoyuVanilla linked a pull request Mar 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants