Auto merge of #98758 - nnethercote:more-derive-output-improvements, r=Mark-Simulacrum

More derive output improvements

This PR includes:
- Some test improvements.
- Some cosmetic changes to derive output that make the code look more like what a human would write.
- Some more fundamental improvements to `cmp` and `partial_cmp` generation.

r? `@Mark-Simulacrum`
This commit is contained in:
bors 2022-07-08 12:44:14 +00:00
commit fbdb07f4e7
15 changed files with 655 additions and 568 deletions

View file

@ -39,6 +39,16 @@ struct Big {
#[repr(packed)]
struct Packed(u32);
// An empty enum.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
enum Enum0 {}
// A single-variant enum.
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
enum Enum1 {
Single { x: u32 }
}
// A C-like, fieldless enum.
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
enum Fieldless {
@ -66,3 +76,11 @@ enum Fielded {
Y(bool),
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,
}

File diff suppressed because it is too large Load diff