2021-05-13 14:42:25 +00:00
|
|
|
// 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 } }
|
|
|
|
|
2020-10-04 20:24:14 +00:00
|
|
|
#[derive(PartialEq, Copy, Clone)]
|
2016-08-26 16:23:42 +00:00
|
|
|
struct PartialEqNotEq;
|
|
|
|
|
|
|
|
#[derive(Eq)]
|
|
|
|
union U2 {
|
2020-09-02 07:40:56 +00:00
|
|
|
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() {}
|