diff options
| author | bors <bors@rust-lang.org> | 2021-07-15 19:51:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-15 19:51:17 +0000 |
| commit | b1f8e27b74c541d3d555149c8efa4bfe9385cd56 (patch) | |
| tree | 888b8d3d6fa20129600bc8ee9a58cfbbed246160 /src | |
| parent | 26366828a40403c83d6cc29bf5614a6e0388354c (diff) | |
| parent | d49f977ed9fef7bc0734693eb6f6b1f41b72735e (diff) | |
| download | rust-b1f8e27b74c541d3d555149c8efa4bfe9385cd56.tar.gz rust-b1f8e27b74c541d3d555149c8efa4bfe9385cd56.zip | |
Auto merge of #83319 - tmiasko:packed-aligned, r=jackh726
Layout error instead of an ICE for packed and aligned types Fixes #83107.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/conflicting-repr-hints.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/conflicting-repr-hints.stderr | 16 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/test/ui/conflicting-repr-hints.rs b/src/test/ui/conflicting-repr-hints.rs index 09dade20992..ed82b6a742c 100644 --- a/src/test/ui/conflicting-repr-hints.rs +++ b/src/test/ui/conflicting-repr-hints.rs @@ -66,4 +66,15 @@ union Z { i: i32, } +#[repr(packed, align(0x100))] +pub struct S(u16); //~ ERROR type has conflicting packed and align representation hints + +#[repr(packed, align(0x100))] +pub union U { //~ ERROR type has conflicting packed and align representation hints + u: u16 +} + +static B: U = U { u: 0 }; +static A: S = S(0); + fn main() {} diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr index 0b78532c737..0f32fc0481b 100644 --- a/src/test/ui/conflicting-repr-hints.stderr +++ b/src/test/ui/conflicting-repr-hints.stderr @@ -74,7 +74,21 @@ LL | | i: i32, LL | | } | |_^ -error: aborting due to 10 previous errors +error[E0587]: type has conflicting packed and align representation hints + --> $DIR/conflicting-repr-hints.rs:70:1 + | +LL | pub struct S(u16); + | ^^^^^^^^^^^^^^^^^^ + +error[E0587]: type has conflicting packed and align representation hints + --> $DIR/conflicting-repr-hints.rs:73:1 + | +LL | / pub union U { +LL | | u: u16 +LL | | } + | |_^ + +error: aborting due to 12 previous errors Some errors have detailed explanations: E0566, E0587, E0634. For more information about an error, try `rustc --explain E0566`. |
