]> git.proxmox.com Git - rustc.git/blob - src/test/ui/derives/deriving-with-repr-packed.rs
New upstream version 1.53.0+dfsg1
[rustc.git] / src / test / ui / derives / deriving-with-repr-packed.rs
1 #![deny(unaligned_references)]
2
3 // check that derive on a packed struct with non-Copy fields
4 // correctly. This can't be made to work perfectly because
5 // we can't just use the field from the struct as it might
6 // not be aligned.
7
8 #[derive(Copy, Clone, PartialEq, Eq)]
9 //~^ ERROR `#[derive]` can't be used
10 //~| hard error
11 //~^^^ ERROR `#[derive]` can't be used
12 //~| hard error
13 #[repr(packed)]
14 pub struct Foo<T>(T, T, T);
15
16 #[derive(PartialEq, Eq)]
17 //~^ ERROR `#[derive]` can't be used
18 //~| hard error
19 #[repr(packed)]
20 pub struct Bar(u32, u32, u32);
21
22 #[derive(PartialEq)]
23 struct Y(usize);
24
25 #[derive(PartialEq)]
26 //~^ ERROR `#[derive]` can't be used
27 //~| hard error
28 #[repr(packed)]
29 struct X(Y);
30
31 fn main() {}