Skip to content

Conversation

@japaric
Copy link
Contributor

@japaric japaric commented Oct 29, 2014

  • The signature of the *_equiv methods of HashMap and similar structures have changed, and now require one less level of indirection. Change your code from:
hashmap.find_equiv(&"Hello");
hashmap.find_equiv(&&[0u8, 1, 2]);

to:

hashmap.find_equiv("Hello");
hashmap.find_equiv(&[0u8, 1, 2]);
  • The generic parameter T of the Hasher::hash<T> method have become Sized?. Downstream code must add Sized? to that method in their implementations. For example:
impl Hasher<FnvState> for FnvHasher {
    fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
}

must be changed to:

impl Hasher<FnvState> for FnvHasher {
    fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
    //      ^^^^^^
}

[breaking-change]


After review I'll squash the commits and update the commit message with the above paragraph.

r? @aturon
cc #16918

@aturon
Copy link
Contributor

aturon commented Oct 31, 2014

This is great! Thanks for doing this work. I basically think it's fine to go after a squash.

(It is a little sad to have to require Sized? on all Hash impls, but that's a general ergonomic concern.)

@japaric
Copy link
Contributor Author

japaric commented Oct 31, 2014

Rebased and squashed.

@aturon re-r?

- The signature of the `*_equiv` methods of `HashMap` and similar structures
have changed, and now require one less level of indirection. Change your code
from:

```
hashmap.find_equiv(&"Hello");
hashmap.find_equiv(&&[0u8, 1, 2]);
```

to:

```
hashmap.find_equiv("Hello");
hashmap.find_equiv(&[0u8, 1, 2]);
```

- The generic parameter `T` of the `Hasher::hash<T>` method have become
`Sized?`. Downstream code must add `Sized?` to that method in their
implementations. For example:

```
impl Hasher<FnvState> for FnvHasher {
    fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
}
```

must be changed to:

```
impl Hasher<FnvState> for FnvHasher {
    fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
    //      ^^^^^^
}
```

[breaking-change]
@japaric
Copy link
Contributor Author

japaric commented Oct 31, 2014

The last roll-up resulted in merge conflict and introduced more find_equiv method calls that I had to fix.

@aturon re-r?

bors added a commit that referenced this pull request Oct 31, 2014
- The signature of the `*_equiv` methods of `HashMap` and similar structures have changed, and now require one less level of indirection. Change your code from:

``` rust
hashmap.find_equiv(&"Hello");
hashmap.find_equiv(&&[0u8, 1, 2]);
```

to:

``` rust
hashmap.find_equiv("Hello");
hashmap.find_equiv(&[0u8, 1, 2]);
```

- The generic parameter `T` of the `Hasher::hash<T>` method have become `Sized?`. Downstream code must add `Sized?` to that method in their implementations. For example:

``` rust
impl Hasher<FnvState> for FnvHasher {
    fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
}
```

must be changed to:

``` rust
impl Hasher<FnvState> for FnvHasher {
    fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
    //      ^^^^^^
}
```

[breaking-change]

---

After review I'll squash the commits and update the commit message with the above paragraph.

r? @aturon 
cc #16918
@bors bors closed this Oct 31, 2014
@bors bors merged commit 1384a43 into rust-lang:master Oct 31, 2014
@japaric japaric deleted the hash branch November 1, 2014 05:28
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.

4 participants