Skip to content

Commit 18f8495

Browse files
committed
Add an interesting case to the deriving-all-codegen.rs test.
1 parent 46b8c23 commit 18f8495

File tree

2 files changed

+114
-2
lines changed

2 files changed

+114
-2
lines changed

src/test/ui/deriving/deriving-all-codegen.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ struct Point {
2828
y: u32,
2929
}
3030

31-
// A long struct.
31+
// A large struct.
3232
#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
3333
struct Big {
3434
b1: u32, b2: u32, b3: u32, b4: u32, b5: u32, b6: u32, b7: u32, b8:u32,
3535
}
3636

37+
// A packed tuple struct.
38+
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
39+
#[repr(packed)]
40+
struct Packed(u32);
41+
3742
// A C-like, fieldless enum.
3843
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
3944
enum Fieldless {

src/test/ui/deriving/deriving-all-codegen.stdout

+108-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl ::core::cmp::Ord for Point {
244244
}
245245
}
246246

247-
// A long struct.
247+
// A large struct.
248248
struct Big {
249249
b1: u32,
250250
b2: u32,
@@ -593,6 +593,113 @@ impl ::core::cmp::Ord for Big {
593593
}
594594
}
595595

596+
// A packed tuple struct.
597+
#[repr(packed)]
598+
struct Packed(u32);
599+
#[automatically_derived]
600+
#[allow(unused_qualifications)]
601+
impl ::core::clone::Clone for Packed {
602+
#[inline]
603+
fn clone(&self) -> Packed {
604+
{ let _: ::core::clone::AssertParamIsClone<u32>; *self }
605+
}
606+
}
607+
#[automatically_derived]
608+
#[allow(unused_qualifications)]
609+
impl ::core::marker::Copy for Packed { }
610+
#[automatically_derived]
611+
#[allow(unused_qualifications)]
612+
impl ::core::fmt::Debug for Packed {
613+
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
614+
match *self {
615+
Self(__self_0_0) =>
616+
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Packed",
617+
&&(__self_0_0)),
618+
}
619+
}
620+
}
621+
#[automatically_derived]
622+
#[allow(unused_qualifications)]
623+
impl ::core::default::Default for Packed {
624+
#[inline]
625+
fn default() -> Packed { Packed(::core::default::Default::default()) }
626+
}
627+
#[automatically_derived]
628+
#[allow(unused_qualifications)]
629+
impl ::core::hash::Hash for Packed {
630+
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
631+
match *self {
632+
Self(__self_0_0) => {
633+
::core::hash::Hash::hash(&(__self_0_0), state)
634+
}
635+
}
636+
}
637+
}
638+
impl ::core::marker::StructuralPartialEq for Packed {}
639+
#[automatically_derived]
640+
#[allow(unused_qualifications)]
641+
impl ::core::cmp::PartialEq for Packed {
642+
#[inline]
643+
fn eq(&self, other: &Packed) -> bool {
644+
match *other {
645+
Self(__self_1_0) =>
646+
match *self {
647+
Self(__self_0_0) => (__self_0_0) == (__self_1_0),
648+
},
649+
}
650+
}
651+
}
652+
impl ::core::marker::StructuralEq for Packed {}
653+
#[automatically_derived]
654+
#[allow(unused_qualifications)]
655+
impl ::core::cmp::Eq for Packed {
656+
#[inline]
657+
#[doc(hidden)]
658+
#[no_coverage]
659+
fn assert_receiver_is_total_eq(&self) -> () {
660+
{ let _: ::core::cmp::AssertParamIsEq<u32>; }
661+
}
662+
}
663+
#[automatically_derived]
664+
#[allow(unused_qualifications)]
665+
impl ::core::cmp::PartialOrd for Packed {
666+
#[inline]
667+
fn partial_cmp(&self, other: &Packed)
668+
-> ::core::option::Option<::core::cmp::Ordering> {
669+
match *other {
670+
Self(__self_1_0) =>
671+
match *self {
672+
Self(__self_0_0) =>
673+
match ::core::cmp::PartialOrd::partial_cmp(&(__self_0_0),
674+
&(__self_1_0)) {
675+
::core::option::Option::Some(::core::cmp::Ordering::Equal)
676+
=>
677+
::core::option::Option::Some(::core::cmp::Ordering::Equal),
678+
cmp => cmp,
679+
},
680+
},
681+
}
682+
}
683+
}
684+
#[automatically_derived]
685+
#[allow(unused_qualifications)]
686+
impl ::core::cmp::Ord for Packed {
687+
#[inline]
688+
fn cmp(&self, other: &Packed) -> ::core::cmp::Ordering {
689+
match *other {
690+
Self(__self_1_0) =>
691+
match *self {
692+
Self(__self_0_0) =>
693+
match ::core::cmp::Ord::cmp(&(__self_0_0), &(__self_1_0)) {
694+
::core::cmp::Ordering::Equal =>
695+
::core::cmp::Ordering::Equal,
696+
cmp => cmp,
697+
},
698+
},
699+
}
700+
}
701+
}
702+
596703
// A C-like, fieldless enum.
597704
enum Fieldless {
598705

0 commit comments

Comments
 (0)