rust/tests/ui/union/union-derive-eq.rs
2023-01-11 09:32:08 +00:00

22 lines
458 B
Rust

// revisions: mirunsafeck thirunsafeck
// [thirunsafeck]compile-flags: -Z thir-unsafeck
#[derive(Eq)] // OK
union U1 {
a: u8,
}
impl PartialEq for U1 { fn eq(&self, rhs: &Self) -> bool { true } }
#[derive(PartialEq, Copy, Clone)]
struct PartialEqNotEq;
#[derive(Eq)]
union U2 {
a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: Eq` is not satisfied
}
impl PartialEq for U2 { fn eq(&self, rhs: &Self) -> bool { true } }
fn main() {}