- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
#[derive(Copy, Clone)]
pub struct B;
mod a {
    pub union U {
        pub a: i32,
        b: crate::B,
    }
}
fn new(a: i32) -> B {
    unsafe { a::U { a }.b }
}Errors:
    Compiling playground v0.0.1 (/playground)
error[E0616]: field `b` of struct `a::U` is private
  --> src/lib.rs:12:14
   |
12 |     unsafe { a::U { a }.b }
   |              ^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0616`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
Notice how it says "struct" when it should say "union".
cc @estebank this looks like low-hanging fruit
estebank
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.