summary refs log tree commit diff
path: root/src/libcore/cmp.rs
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-10-24 12:25:50 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-10-31 07:25:34 -0500
commit1384a43db3a8b1551bfc3c6feb37e2174d4c2ba0 (patch)
treee45a0343003c22ed5b1ccbaa008189db578c3658 /src/libcore/cmp.rs
parent065caf34f5ff29e04605f95d9c5d511af219439a (diff)
downloadrust-1384a43db3a8b1551bfc3c6feb37e2174d4c2ba0.tar.gz
rust-1384a43db3a8b1551bfc3c6feb37e2174d4c2ba0.zip
DSTify Hash
- 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]
Diffstat (limited to 'src/libcore/cmp.rs')
-rw-r--r--src/libcore/cmp.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 505dc183480..d7c2b52b8de 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -39,6 +39,7 @@
 
 #![stable]
 
+use kinds::Sized;
 use option::{Option, Some, None};
 
 /// Trait for values that can be compared for equality and inequality.
@@ -236,7 +237,7 @@ pub trait PartialOrd: PartialEq {
 /// container types; e.g. it is often desirable to be able to use `&str`
 /// values to look up entries in a container with `String` keys.
 #[experimental = "Better solutions may be discovered."]
-pub trait Equiv<T> {
+pub trait Equiv<T> for Sized? {
     /// Implement this function to decide equivalent values.
     fn equiv(&self, other: &T) -> bool;
 }