Add a struct with an unsized field to the deriving-all-codegen.rs test.
It's an interesting case, requiring the use of `&&` in `Debug::fmt`.
This commit is contained in:
parent
c6ff90b00e
commit
292de22276
2 changed files with 60 additions and 1 deletions
|
|
@ -31,9 +31,13 @@ struct Point {
|
|||
// A large struct.
|
||||
#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
struct Big {
|
||||
b1: u32, b2: u32, b3: u32, b4: u32, b5: u32, b6: u32, b7: u32, b8:u32,
|
||||
b1: u32, b2: u32, b3: u32, b4: u32, b5: u32, b6: u32, b7: u32, b8: u32,
|
||||
}
|
||||
|
||||
// A struct with an unsized field. Some derives are not usable in this case.
|
||||
#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
struct Unsized([u32]);
|
||||
|
||||
// A packed tuple struct.
|
||||
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[repr(packed)]
|
||||
|
|
|
|||
|
|
@ -367,6 +367,61 @@ impl ::core::cmp::Ord for Big {
|
|||
}
|
||||
}
|
||||
|
||||
// A struct with an unsized field. Some derives are not usable in this case.
|
||||
struct Unsized([u32]);
|
||||
#[automatically_derived]
|
||||
#[allow(unused_qualifications)]
|
||||
impl ::core::fmt::Debug for Unsized {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Unsized",
|
||||
&&self.0)
|
||||
}
|
||||
}
|
||||
#[automatically_derived]
|
||||
#[allow(unused_qualifications)]
|
||||
impl ::core::hash::Hash for Unsized {
|
||||
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
|
||||
::core::hash::Hash::hash(&self.0, state)
|
||||
}
|
||||
}
|
||||
impl ::core::marker::StructuralPartialEq for Unsized {}
|
||||
#[automatically_derived]
|
||||
#[allow(unused_qualifications)]
|
||||
impl ::core::cmp::PartialEq for Unsized {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Unsized) -> bool { self.0 == other.0 }
|
||||
#[inline]
|
||||
fn ne(&self, other: &Unsized) -> bool { self.0 != other.0 }
|
||||
}
|
||||
impl ::core::marker::StructuralEq for Unsized {}
|
||||
#[automatically_derived]
|
||||
#[allow(unused_qualifications)]
|
||||
impl ::core::cmp::Eq for Unsized {
|
||||
#[inline]
|
||||
#[doc(hidden)]
|
||||
#[no_coverage]
|
||||
fn assert_receiver_is_total_eq(&self) -> () {
|
||||
let _: ::core::cmp::AssertParamIsEq<[u32]>;
|
||||
}
|
||||
}
|
||||
#[automatically_derived]
|
||||
#[allow(unused_qualifications)]
|
||||
impl ::core::cmp::PartialOrd for Unsized {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Unsized)
|
||||
-> ::core::option::Option<::core::cmp::Ordering> {
|
||||
::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0)
|
||||
}
|
||||
}
|
||||
#[automatically_derived]
|
||||
#[allow(unused_qualifications)]
|
||||
impl ::core::cmp::Ord for Unsized {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &Unsized) -> ::core::cmp::Ordering {
|
||||
::core::cmp::Ord::cmp(&self.0, &other.0)
|
||||
}
|
||||
}
|
||||
|
||||
// A packed tuple struct.
|
||||
#[repr(packed)]
|
||||
struct Packed(u32);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue