forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#10184 - robertbastian:master, r=xFrednet
Allow implementing `Hash` with derived `PartialEq` (`derive_hash_xor_eq` This is a common pattern and is totally allowed by the `Hash` trait. Fixes rust-lang#2627 changelog: Move: Renamed `derive_hash_xor_eq` to [`derived_hash_with_manual_eq`] [rust-lang#10184](rust-lang/rust-clippy#10184) changelog: Enhancement: [`derived_hash_with_manual_eq`]: Now allows `#[derive(PartialEq)]` with custom `Hash` implementations [rust-lang#10184](rust-lang/rust-clippy#10184) <!-- changelog_checked -->
- Loading branch information
Showing
10 changed files
with
92 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
error: you are deriving `Hash` but have implemented `PartialEq` explicitly | ||
--> $DIR/derived_hash_with_manual_eq.rs:12:10 | ||
| | ||
LL | #[derive(Hash)] | ||
| ^^^^ | ||
| | ||
note: `PartialEq` implemented here | ||
--> $DIR/derived_hash_with_manual_eq.rs:15:1 | ||
| | ||
LL | impl PartialEq for Bar { | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: `#[deny(clippy::derived_hash_with_manual_eq)]` on by default | ||
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: you are deriving `Hash` but have implemented `PartialEq` explicitly | ||
--> $DIR/derived_hash_with_manual_eq.rs:21:10 | ||
| | ||
LL | #[derive(Hash)] | ||
| ^^^^ | ||
| | ||
note: `PartialEq` implemented here | ||
--> $DIR/derived_hash_with_manual_eq.rs:24:1 | ||
| | ||
LL | impl PartialEq<Baz> for Baz { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.