1 #![deny(unaligned_references)]
3 // Check that deriving certain builtin traits on certain packed structs cause
4 // errors. To avoid potentially misaligned references, field copies must be
5 // used, which involves adding `T: Copy` bounds.
7 #[derive(Copy, Clone, Default, PartialEq, Eq)]
9 pub struct Foo<T>(T, T, T);
14 // This one is fine because `u32` impls `Copy`.
15 let x: Foo<u32> = Foo(1, 2, 3);
18 // This one is an error because `NonCopy` doesn't impl `Copy`.
19 let x: Foo<NonCopy> = Foo(NonCopy, NonCopy, NonCopy);
21 //~^ ERROR the method `clone` exists for struct `Foo<NonCopy>`, but its trait bounds were not satisfied