-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Latest in series of fixing the derive macros to require the correct bounds. This time, basically, "The hash operators are used for hashmappy things, so they should have the same bounds as hashmaps." Moves away from the briefly-adopted `#[doc(hidden)]` trait pattern to instead using a "trivial bound" for these. It didn't actually occur to me, first go-around, that such was correct in Rust and would emit a similar, reasonably-nice error.
- Loading branch information
1 parent
6d29974
commit 27a0d16
Showing
7 changed files
with
64 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use pgrx::prelude::*; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Serialize, Deserialize, PostgresType, PostgresHash)] | ||
pub struct BrokenType { | ||
int: i32, | ||
} | ||
|
||
fn main() {} |
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,27 @@ | ||
error[E0277]: the trait bound `BrokenType: std::cmp::Eq` is not satisfied | ||
--> tests/ui/eq_for_postgres_hash.rs:4:48 | ||
| | ||
4 | #[derive(Serialize, Deserialize, PostgresType, PostgresHash)] | ||
| ^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `BrokenType` | ||
| | ||
= help: see issue #48214 | ||
= note: this error originates in the derive macro `PostgresHash` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: consider annotating `BrokenType` with `#[derive(Eq)]` | ||
| | ||
5 + #[derive(Eq)] | ||
6 | pub struct BrokenType { | ||
| | ||
|
||
error[E0277]: the trait bound `BrokenType: std::hash::Hash` is not satisfied | ||
--> tests/ui/eq_for_postgres_hash.rs:4:48 | ||
| | ||
4 | #[derive(Serialize, Deserialize, PostgresType, PostgresHash)] | ||
| ^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `BrokenType` | ||
| | ||
= help: see issue #48214 | ||
= note: this error originates in the derive macro `PostgresHash` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: consider annotating `BrokenType` with `#[derive(Hash)]` | ||
| | ||
5 + #[derive(Hash)] | ||
6 | pub struct BrokenType { | ||
| |
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