Rollup merge of #67956 - varkor:E0588-provide-context, r=estebank

Detail transitive containment in E0588 diagnostic

Fixes https://github.com/rust-lang/rust/issues/67383.
This commit is contained in:
Dylan DPC 2020-01-17 11:16:32 +05:30 committed by GitHub
commit 9f4b328da2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 174 additions and 41 deletions

View file

@ -16,34 +16,34 @@ union UB {
}
#[repr(packed)]
struct SC(SA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
struct SC(SA); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(packed)]
struct SD(SB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
struct SD(SB); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(packed)]
struct SE(UA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
struct SE(UA); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(packed)]
struct SF(UB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
struct SF(UB); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(packed)]
union UC { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
union UC { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
a: UA
}
#[repr(packed)]
union UD { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
union UD { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
n: UB
}
#[repr(packed)]
union UE { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
union UE { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
a: SA
}
#[repr(packed)]
union UF { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
union UF { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
n: SB
}

View file

@ -1,58 +1,154 @@
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:19:1
|
LL | struct SC(SA);
| ^^^^^^^^^^^^^^
|
note: `SA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:5:1
|
LL | struct SA(i32);
| ^^^^^^^^^^^^^^^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:22:1
|
LL | struct SD(SB);
| ^^^^^^^^^^^^^^
|
note: `SA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:5:1
|
LL | struct SA(i32);
| ^^^^^^^^^^^^^^^
note: `SD` contains a field of type `SB`
--> $DIR/repr-packed-contains-align.rs:22:11
|
LL | struct SD(SB);
| ^^
note: ...which contains a field of type `SA`
--> $DIR/repr-packed-contains-align.rs:7:11
|
LL | struct SB(SA);
| ^^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:25:1
|
LL | struct SE(UA);
| ^^^^^^^^^^^^^^
|
note: `UA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:10:1
|
LL | / union UA {
LL | | i: i32
LL | | }
| |_^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:28:1
|
LL | struct SF(UB);
| ^^^^^^^^^^^^^^
|
note: `UA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:10:1
|
LL | / union UA {
LL | | i: i32
LL | | }
| |_^
note: `SF` contains a field of type `UB`
--> $DIR/repr-packed-contains-align.rs:28:11
|
LL | struct SF(UB);
| ^^
note: ...which contains a field of type `UA`
--> $DIR/repr-packed-contains-align.rs:15:5
|
LL | a: UA
| ^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:31:1
|
LL | / union UC {
LL | | a: UA
LL | | }
| |_^
|
note: `UA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:10:1
|
LL | / union UA {
LL | | i: i32
LL | | }
| |_^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:36:1
|
LL | / union UD {
LL | | n: UB
LL | | }
| |_^
|
note: `UA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:10:1
|
LL | / union UA {
LL | | i: i32
LL | | }
| |_^
note: `UD` contains a field of type `UB`
--> $DIR/repr-packed-contains-align.rs:37:5
|
LL | n: UB
| ^
note: ...which contains a field of type `UA`
--> $DIR/repr-packed-contains-align.rs:15:5
|
LL | a: UA
| ^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:41:1
|
LL | / union UE {
LL | | a: SA
LL | | }
| |_^
|
note: `SA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:5:1
|
LL | struct SA(i32);
| ^^^^^^^^^^^^^^^
error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/repr-packed-contains-align.rs:46:1
|
LL | / union UF {
LL | | n: SB
LL | | }
| |_^
|
note: `SA` has a `#[repr(align)]` attribute
--> $DIR/repr-packed-contains-align.rs:5:1
|
LL | struct SA(i32);
| ^^^^^^^^^^^^^^^
note: `UF` contains a field of type `SB`
--> $DIR/repr-packed-contains-align.rs:47:5
|
LL | n: SB
| ^
note: ...which contains a field of type `SA`
--> $DIR/repr-packed-contains-align.rs:7:11
|
LL | struct SB(SA);
| ^^
error: aborting due to 8 previous errors