Rollup merge of #58370 - nox:relax-bounds, r=dtolnay

Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>

Notably, hash iterators don't require any trait bounds to be iterated.
This commit is contained in:
Mazdak Farrokhzad 2019-02-25 03:17:58 +01:00 committed by GitHub
commit 03acebe2ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 354 additions and 364 deletions

View file

@ -1,6 +1,7 @@
use std::collections::HashMap;
fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {
this.drain()
use std::collections::HashSet;
fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool {
this.is_subset(other)
//~^ ERROR no method named
}

View file

@ -1,12 +1,12 @@
error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope
--> $DIR/issue-35677.rs:3:10
error[E0599]: no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope
--> $DIR/issue-35677.rs:4:10
|
LL | this.drain()
| ^^^^^
LL | this.is_subset(other)
| ^^^^^^^^^
|
= note: the method `drain` exists but the following trait bounds were not satisfied:
`K : std::cmp::Eq`
`K : std::hash::Hash`
= note: the method `is_subset` exists but the following trait bounds were not satisfied:
`T : std::cmp::Eq`
`T : std::hash::Hash`
error: aborting due to previous error