rust/tests/ui/union/union-derive-eq.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
458 B
Rust
Raw Normal View History

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