Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[breaking-change] use hash32 v0.3.0 #284

Merged
merged 4 commits into from
Aug 12, 2022
Merged

[breaking-change] use hash32 v0.3.0 #284

merged 4 commits into from
Aug 12, 2022

Conversation

japaric
Copy link
Member

@japaric japaric commented Apr 29, 2022

this release of hash32 has the advantage that 32-bit hashers can be used to hash types that
implement the core::hash::Hash trait removing the need for the hash32::Hash implementations in
this crate and the uses of the #[derive(Hash32)] macro (which did not support enums) in dependent
crates

with this change the following code works

// NOTE no derive(Hash32)
#[derive(Hash)]
struct Int(i32);

let mut x = FnvIndexSet::<_, 4>::default();
let _ = x.insert(Int(0));

this change is technically a breaking change because the following code is no longer accepted

// assume this type comes from a dependency
// NOTE no derive(Hash)
#[derive(Hash32)]
struct Int(i32);

let mut x = FnvIndexSet::<_, 4>::default();
let _ = x.insert(Int(0)); // error: does not implement Hash

@korken89
Copy link
Contributor

korken89 commented May 1, 2022

Nice improvement!

@japaric japaric added this to the v0.8.0 milestone May 10, 2022
@pwnorbitals
Copy link

Awesome ! Can’t wait to have it merged :)

this release of `hash32` has the advantage that 32-bit hashers can be used to hash types that
implement the `core::hash::Hash` trait removing the need for the `hash32::Hash` implementations in
this crate and the uses of the `#[derive(Hash32)]` macro (which did not support enums) in dependent
crates

with this change the following code works
``` rust
// NOTE no derive(Hash32)
struct Int(i32);

let mut x = FnvIndexSet::<_, 4>::default();
let _ = x.insert(Int(0));
```

this change is technically a breaking change because the following code is no longer accepted

``` rust
// assume this type comes from a dependency
// NOTE no derive(Hash)
struct Int(i32);

let mut x = FnvIndexSet::<_, 4>::default();
let _ = x.insert(Int(0)); // error: does not implement Hash
```
to ensure we don't do another 0.7.x release by mistake
@japaric
Copy link
Member Author

japaric commented Aug 12, 2022

bors merge

bors bot added a commit that referenced this pull request Aug 12, 2022
284: [breaking-change] use hash32 v0.3.0 r=japaric a=japaric

this release of `hash32` has the advantage that 32-bit hashers can be used to hash types that
implement the `core::hash::Hash` trait removing the need for the `hash32::Hash` implementations in
this crate and the uses of the `#[derive(Hash32)]` macro (which did not support enums) in dependent
crates

with this change the following code works
``` rust
// NOTE no derive(Hash32)
#[derive(Hash)]
struct Int(i32);

let mut x = FnvIndexSet::<_, 4>::default();
let _ = x.insert(Int(0));
```

this change is technically a breaking change because the following code is no longer accepted

``` rust
// assume this type comes from a dependency
// NOTE no derive(Hash)
#[derive(Hash32)]
struct Int(i32);

let mut x = FnvIndexSet::<_, 4>::default();
let _ = x.insert(Int(0)); // error: does not implement Hash
```

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
@bors
Copy link
Contributor

bors bot commented Aug 12, 2022

Build failed:

@japaric
Copy link
Member Author

japaric commented Aug 12, 2022

should work now that MSRV checks are gone
bors merge

@bors
Copy link
Contributor

bors bot commented Aug 12, 2022

Build succeeded:

@bors bors bot merged commit 97ac129 into main Aug 12, 2022
@bors bors bot deleted the hash32-up branch August 12, 2022 14:49
@pwnorbitals
Copy link

Thanks Japaric, awesome !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants