Skip to content

ICE when trying to move from reference in union #66500

Closed
@matthewjasper

Description

@matthewjasper

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 }
}

Metadata

Metadata

Assignees

Labels

A-borrow-checkerArea: The borrow checkerC-bugCategory: This is a bug.F-untagged_unions`#![feature(untagged_unions)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions