Add a union to the deriving-all-codegen.rs test.

Because `derive(Clone)` on unions triggers special behaviour.
This commit is contained in:
Nicholas Nethercote 2022-07-01 16:47:12 +10:00
parent d46c728bcd
commit 9d38c45a11
2 changed files with 26 additions and 0 deletions

View File

@ -66,3 +66,11 @@ enum Fielded {
Y(bool), Y(bool),
Z(Option<i32>), Z(Option<i32>),
} }
// A union. Most builtin traits are not derivable for unions.
#[derive(Clone, Copy)]
pub union Union {
pub b: bool,
pub u: u32,
pub i: i32,
}

View File

@ -1020,3 +1020,21 @@ impl ::core::cmp::Ord for Fielded {
} }
} }
} }
// A union. Most builtin traits are not derivable for unions.
pub union Union {
pub b: bool,
pub u: u32,
pub i: i32,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::clone::Clone for Union {
#[inline]
fn clone(&self) -> Union {
{ let _: ::core::clone::AssertParamIsCopy<Self>; *self }
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::marker::Copy for Union { }