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

ICE when trying to move from reference in union #66500

Closed
matthewjasper opened this issue Nov 17, 2019 · 3 comments · Fixed by #67314
Closed

ICE when trying to move from reference in union #66500

matthewjasper opened this issue Nov 17, 2019 · 3 comments · Fixed by #67314
Assignees
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. F-untagged_unions `#![feature(untagged_unions)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthewjasper
Copy link
Contributor

The following code ICEs, when it should produce a cannot move error

union U<'a> {
    x: &'a String,
}

fn f(u: U<'_>) -> String {
    unsafe { *u.x }
}
@matthewjasper matthewjasper added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-borrow-checker Area: The borrow checker labels Nov 17, 2019
@matthewjasper matthewjasper self-assigned this Nov 17, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 17, 2019
@matthewjasper matthewjasper added the F-untagged_unions `#![feature(untagged_unions)]` label Nov 17, 2019
@matthewjasper
Copy link
Contributor Author

Worse, the following compiles:

#![feature(untagged_unions)]

union U<'a> {
    x: &'a mut String,
}

fn f(u: U<'_>) -> String {
    unsafe { *u.x }
}

@hellow554
Copy link
Contributor

regression from stable-to-beta and stable-to-nightly

@estebank estebank added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Nov 18, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Nov 18, 2019
@pnkfelix
Copy link
Member

triage: P-high

@pnkfelix pnkfelix added the P-high High priority label Nov 21, 2019
Centril added a commit to Centril/rust that referenced this issue Dec 20, 2019
…nikomatsakis

Don't suppress move errors for union fields

closes rust-lang#66500
@bors bors closed this as completed in 86282d0 Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. F-untagged_unions `#![feature(untagged_unions)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants