3 use std
::collections
::{HashMap, HashSet}
;
5 use std
::hash
::{Hash, BuildHasher}
;
7 pub trait Foo
<T
>: Sized
{
8 fn make() -> (Self, Self);
11 impl<K
: Hash
+ Eq
, V
> Foo
<i8> for HashMap
<K
, V
> {
12 fn make() -> (Self, Self) {
13 // OK, don't suggest to modify these
14 let _
: HashMap
<i32, i32> = HashMap
::new();
15 let _
: HashSet
<i32> = HashSet
::new();
17 (HashMap
::new(), HashMap
::with_capacity(10))
20 impl<K
: Hash
+ Eq
, V
> Foo
<i8> for (HashMap
<K
, V
>,) {
21 fn make() -> (Self, Self) {
22 ((HashMap
::new(),), (HashMap
::with_capacity(10),))
25 impl Foo
<i16> for HashMap
<String
, String
> {
26 fn make() -> (Self, Self) {
27 (HashMap
::new(), HashMap
::with_capacity(10))
31 impl<K
: Hash
+ Eq
, V
, S
: BuildHasher
+ Default
> Foo
<i32> for HashMap
<K
, V
, S
> {
32 fn make() -> (Self, Self) {
33 (HashMap
::default(), HashMap
::with_capacity_and_hasher(10, Default
::default()))
36 impl<S
: BuildHasher
+ Default
> Foo
<i64> for HashMap
<String
, String
, S
> {
37 fn make() -> (Self, Self) {
38 (HashMap
::default(), HashMap
::with_capacity_and_hasher(10, Default
::default()))
43 impl<T
: Hash
+ Eq
> Foo
<i8> for HashSet
<T
> {
44 fn make() -> (Self, Self) {
45 (HashSet
::new(), HashSet
::with_capacity(10))
48 impl Foo
<i16> for HashSet
<String
> {
49 fn make() -> (Self, Self) {
50 (HashSet
::new(), HashSet
::with_capacity(10))
54 impl<T
: Hash
+ Eq
, S
: BuildHasher
+ Default
> Foo
<i32> for HashSet
<T
, S
> {
55 fn make() -> (Self, Self) {
56 (HashSet
::default(), HashSet
::with_capacity_and_hasher(10, Default
::default()))
59 impl<S
: BuildHasher
+ Default
> Foo
<i64> for HashSet
<String
, S
> {
60 fn make() -> (Self, Self) {
61 (HashSet
::default(), HashSet
::with_capacity_and_hasher(10, Default
::default()))
65 pub fn foo(_map
: &mut HashMap
<i32, i32>, _set
: &mut HashSet
<i32>) {
70 impl<K
: Hash
+ Eq
, V
> Foo
<u8> for HashMap
<K
, V
> {
71 fn make() -> (Self, Self) {
72 (HashMap
::new(), HashMap
::with_capacity(10))
78 pub fn $
name(_map
: &mut HashMap
<i32, i32>, _set
: &mut HashSet
<i32>) {
86 // When the macro is in a different file, the suggestion spans can't be combined properly
87 // and should not cause an ICE
90 #[path = "../auxiliary/test_macro.rs"] pub mod test_macro;
91 __implicit_hasher_test_macro
!(impl<K
, V
> for HashMap
<K
, V
> where V
: test_macro
::A
);