diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.rs b/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.rs new file mode 100644 index 000000000..efe035eba --- /dev/null +++ b/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.rs @@ -0,0 +1,27 @@ +// run-rustfix +// Issue #109429 +use std::collections::hash_map::DefaultHasher; +use std::collections::HashMap; +use std::hash::BuildHasher; +use std::hash::Hash; + +pub struct Hash128_1; + +impl BuildHasher for Hash128_1 { + type Hasher = DefaultHasher; + fn build_hasher(&self) -> DefaultHasher { DefaultHasher::default() } +} + +#[allow(unused)] +pub fn hashmap_copy<T, U>( + map: &HashMap<T, U, Hash128_1>, +) where T: Hash + Clone, U: Clone +{ + let mut copy: Vec<U> = map.clone().into_values().collect(); //~ ERROR +} + +pub fn make_map() -> HashMap<String, i64, Hash128_1> +{ + HashMap::with_hasher(Hash128_1) +} +fn main() {} |