Skip to content

Commit dde2552

Browse files
committed
add test cases for rust-lang#9319
1 parent 1a97d14 commit dde2552

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

tests/ui/derive_partial_eq_without_eq.fixed

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ pub enum MissingEqNonExhaustive3 {
153153
Bar,
154154
}
155155

156-
mod issue_9413 {
156+
mod struct_gen {
157+
// issue 9413
157158
pub trait Group {
158159
type Element: Eq + PartialEq;
159160
}
@@ -168,6 +169,14 @@ mod issue_9413 {
168169

169170
#[derive(PartialEq, Eq)]
170171
pub struct Bar<C: Suite>(i32, <C::Group as Group>::Element);
172+
173+
// issue 9319
174+
#[derive(PartialEq, Eq)]
175+
//~^ ERROR: you are deriving `PartialEq` and can implement `Eq`
176+
pub struct Oof<T: Fn()>(T);
177+
178+
#[derive(PartialEq, Eq)]
179+
pub struct Rab<T: Fn()>(T);
171180
}
172181

173182
fn main() {}

tests/ui/derive_partial_eq_without_eq.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ pub enum MissingEqNonExhaustive3 {
153153
Bar,
154154
}
155155

156-
mod issue_9413 {
156+
mod struct_gen {
157+
// issue 9413
157158
pub trait Group {
158159
type Element: Eq + PartialEq;
159160
}
@@ -168,6 +169,14 @@ mod issue_9413 {
168169

169170
#[derive(PartialEq, Eq)]
170171
pub struct Bar<C: Suite>(i32, <C::Group as Group>::Element);
172+
173+
// issue 9319
174+
#[derive(PartialEq)]
175+
//~^ ERROR: you are deriving `PartialEq` and can implement `Eq`
176+
pub struct Oof<T: Fn()>(T);
177+
178+
#[derive(PartialEq, Eq)]
179+
pub struct Rab<T: Fn()>(T);
171180
}
172181

173182
fn main() {}

tests/ui/derive_partial_eq_without_eq.stderr

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,16 @@ LL | #[derive(PartialEq)]
6868
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
6969

7070
error: you are deriving `PartialEq` and can implement `Eq`
71-
--> tests/ui/derive_partial_eq_without_eq.rs:165:14
71+
--> tests/ui/derive_partial_eq_without_eq.rs:166:14
7272
|
7373
LL | #[derive(PartialEq)]
7474
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
7575

76-
error: aborting due to 12 previous errors
76+
error: you are deriving `PartialEq` and can implement `Eq`
77+
--> tests/ui/derive_partial_eq_without_eq.rs:174:14
78+
|
79+
LL | #[derive(PartialEq)]
80+
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
81+
82+
error: aborting due to 13 previous errors
7783

0 commit comments

Comments
 (0)