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.

31 lines
526 B
Rust
Raw Normal View History

2025-01-22 06:40:43 +00:00
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
2016-08-26 16:23:42 +00:00
#[derive(Eq)] // OK
union U1 {
a: u8,
}
2025-01-22 06:40:43 +00:00
impl PartialEq for U1 {
fn eq(&self, rhs: &Self) -> bool {
true
}
}
2016-08-26 16:23:42 +00:00
#[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
}
2025-01-22 06:40:43 +00:00
impl PartialEq for U2 {
fn eq(&self, rhs: &Self) -> bool {
true
}
}
2016-08-26 16:23:42 +00:00
fn main() {}