add test cases for #9319

This commit is contained in:
J-ZhengLi 2024-03-02 01:06:59 +08:00
parent 1a97d1460b
commit dde2552b11
3 changed files with 28 additions and 4 deletions

View File

@ -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() {}

View File

@ -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<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() {}

View File

@ -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