From dde2552b117a65b74d082136bcb1196455e7572c Mon Sep 17 00:00:00 2001 From: J-ZhengLi Date: Sat, 2 Mar 2024 01:06:59 +0800 Subject: [PATCH] add test cases for #9319 --- tests/ui/derive_partial_eq_without_eq.fixed | 11 ++++++++++- tests/ui/derive_partial_eq_without_eq.rs | 11 ++++++++++- 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(i32, ::Element); + + // issue 9319 + #[derive(PartialEq, Eq)] + //~^ ERROR: you are deriving `PartialEq` and can implement `Eq` + pub struct Oof(T); + + #[derive(PartialEq, Eq)] + pub struct Rab(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 @@ pub trait Suite { #[derive(PartialEq, Eq)] pub struct Bar(i32, ::Element); + + // issue 9319 + #[derive(PartialEq)] + //~^ ERROR: you are deriving `PartialEq` and can implement `Eq` + pub struct Oof(T); + + #[derive(PartialEq, Eq)] + pub struct Rab(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