diff options
| author | J-ZhengLi <lizheng135@huawei.com> | 2024-03-02 01:06:59 +0800 |
|---|---|---|
| committer | J-ZhengLi <lizheng135@huawei.com> | 2024-03-02 01:06:59 +0800 |
| commit | dde2552b117a65b74d082136bcb1196455e7572c (patch) | |
| tree | faf9aeb50507e3756d1645cf04b2db89d557f20d | |
| parent | 1a97d1460b785faa83bf37cc5085b3162b40a64b (diff) | |
| download | rust-dde2552b117a65b74d082136bcb1196455e7572c.tar.gz rust-dde2552b117a65b74d082136bcb1196455e7572c.zip | |
add test cases for #9319
| -rw-r--r-- | tests/ui/derive_partial_eq_without_eq.fixed | 11 | ||||
| -rw-r--r-- | tests/ui/derive_partial_eq_without_eq.rs | 11 | ||||
| -rw-r--r-- | tests/ui/derive_partial_eq_without_eq.stderr | 10 |
3 files changed, 28 insertions, 4 deletions
diff --git a/tests/ui/derive_partial_eq_without_eq.fixed b/tests/ui/derive_partial_eq_without_eq.fixed index 62d8e2ee0c1..6f42487bbf4 100644 --- a/tests/ui/derive_partial_eq_without_eq.fixed +++ b/tests/ui/derive_partial_eq_without_eq.fixed @@ -153,7 +153,8 @@ pub enum MissingEqNonExhaustive3 { Bar, } -mod issue_9413 { +mod struct_gen { + // issue 9413 pub trait Group { type Element: Eq + PartialEq; } @@ -168,6 +169,14 @@ mod issue_9413 { #[derive(PartialEq, Eq)] pub struct Bar<C: Suite>(i32, <C::Group as Group>::Element); + + // issue 9319 + #[derive(PartialEq, Eq)] + //~^ ERROR: you are deriving `PartialEq` and can implement `Eq` + pub struct Oof<T: Fn()>(T); + + #[derive(PartialEq, Eq)] + pub struct Rab<T: Fn()>(T); } fn main() {} diff --git a/tests/ui/derive_partial_eq_without_eq.rs b/tests/ui/derive_partial_eq_without_eq.rs index 024915dd566..24f687c6c9d 100644 --- a/tests/ui/derive_partial_eq_without_eq.rs +++ b/tests/ui/derive_partial_eq_without_eq.rs @@ -153,7 +153,8 @@ pub enum MissingEqNonExhaustive3 { Bar, } -mod issue_9413 { +mod struct_gen { + // issue 9413 pub trait Group { type Element: Eq + PartialEq; } @@ -168,6 +169,14 @@ mod issue_9413 { #[derive(PartialEq, Eq)] pub struct Bar<C: Suite>(i32, <C::Group as Group>::Element); + + // issue 9319 + #[derive(PartialEq)] + //~^ ERROR: you are deriving `PartialEq` and can implement `Eq` + pub struct Oof<T: Fn()>(T); + + #[derive(PartialEq, Eq)] + pub struct Rab<T: Fn()>(T); } fn main() {} diff --git a/tests/ui/derive_partial_eq_without_eq.stderr b/tests/ui/derive_partial_eq_without_eq.stderr index e0ee857dd7a..3d92112dc36 100644 --- a/tests/ui/derive_partial_eq_without_eq.stderr +++ b/tests/ui/derive_partial_eq_without_eq.stderr @@ -68,10 +68,16 @@ LL | #[derive(PartialEq)] | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` error: you are deriving `PartialEq` and can implement `Eq` - --> tests/ui/derive_partial_eq_without_eq.rs:165:14 + --> tests/ui/derive_partial_eq_without_eq.rs:166:14 | LL | #[derive(PartialEq)] | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` -error: aborting due to 12 previous errors +error: you are deriving `PartialEq` and can implement `Eq` + --> tests/ui/derive_partial_eq_without_eq.rs:174:14 + | +LL | #[derive(PartialEq)] + | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` + +error: aborting due to 13 previous errors |
