13 impl PartialEq for Foo1 {
14 fn eq(&self, other: &Foo1) -> bool {
15 self.bar == other.bar && self.baz == other.baz
19 impl fmt::Debug for Foo1 {
20 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
24 f.debug_struct("Foo1")
32 #[derive(Copy, Clone)]
38 impl PartialEq for Foo2 {
39 fn eq(&self, other: &Foo2) -> bool {
40 self.bar == other.bar && self.baz == other.baz
44 impl fmt::Debug for Foo2 {
45 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
49 f.debug_struct("Foo2")
57 #[derive(Copy, Clone)]
63 impl PartialEq for Foo4C {
64 fn eq(&self, other: &Foo4C) -> bool {
65 self.bar == other.bar && self.baz == other.baz
69 impl fmt::Debug for Foo4C {
70 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
74 f.debug_struct("Foo4C")
82 let foo1s = [Foo1 { bar: 1, baz: 2 }; 10];
84 assert_eq!(mem::align_of::<[Foo1; 10]>(), 1);
85 assert_eq!(mem::size_of::<[Foo1; 10]>(), 90);
88 assert_eq!(foo1s[i], Foo1 { bar: 1, baz: 2});
92 assert_eq!(foo, Foo1 { bar: 1, baz: 2 });
95 let foo2s = [Foo2 { bar: 1, baz: 2 }; 10];
97 assert_eq!(mem::align_of::<[Foo2; 10]>(), 2);
98 assert_eq!(mem::size_of::<[Foo2; 10]>(), 100);
101 assert_eq!(foo2s[i], Foo2 { bar: 1, baz: 2});
105 assert_eq!(foo, Foo2 { bar: 1, baz: 2 });
108 let foo4s = [Foo4C { bar: 1, baz: 2 }; 10];
110 assert_eq!(mem::align_of::<[Foo4C; 10]>(), 4);
111 assert_eq!(mem::size_of::<[Foo4C; 10]>(), 120);
114 assert_eq!(foo4s[i], Foo4C { bar: 1, baz: 2});
118 assert_eq!(foo, Foo4C { bar: 1, baz: 2 });