@@ -4,6 +4,9 @@ error: mutable key type
4
4
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^
6
6
|
7
+ = note: ... because it contains `Key`, which has interior mutability
8
+ = note: ... because it contains `AtomicUsize`, which has interior mutability
9
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
7
10
= note: `-D clippy::mutable-key-type` implied by `-D warnings`
8
11
= help: to override `-D warnings` add `#[allow(clippy::mutable_key_type)]`
9
12
@@ -12,84 +15,141 @@ error: mutable key type
12
15
|
13
16
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
14
17
| ^^^^^^^^^^^^
18
+ |
19
+ = note: ... because it contains `Key`, which has interior mutability
20
+ = note: ... because it contains `AtomicUsize`, which has interior mutability
21
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
15
22
16
23
error: mutable key type
17
24
--> tests/ui/mut_key.rs:35:5
18
25
|
19
26
LL | let _other: HashMap<Key, bool> = HashMap::new();
20
27
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28
+ |
29
+ = note: ... because it contains `Key`, which has interior mutability
30
+ = note: ... because it contains `AtomicUsize`, which has interior mutability
31
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
21
32
22
33
error: mutable key type
23
34
--> tests/ui/mut_key.rs:63:22
24
35
|
25
36
LL | fn tuples_bad<U>(_m: &mut HashMap<(Key, U), bool>) {}
26
37
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38
+ |
39
+ = note: ... because it contains `(Key, U)`, which has interior mutability
40
+ = note: ... because it contains `Key`, which has interior mutability
41
+ = note: ... because it contains `AtomicUsize`, which has interior mutability
42
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
27
43
28
44
error: mutable key type
29
45
--> tests/ui/mut_key.rs:76:5
30
46
|
31
47
LL | let _map = HashMap::<Cell<usize>, usize>::new();
32
48
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49
+ |
50
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
51
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
33
52
34
53
error: mutable key type
35
54
--> tests/ui/mut_key.rs:78:5
36
55
|
37
56
LL | let _map = HashMap::<&mut Cell<usize>, usize>::new();
38
57
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58
+ |
59
+ = note: ... because it contains `&mut Cell<usize>`, which has interior mutability
60
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
61
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
39
62
40
63
error: mutable key type
41
64
--> tests/ui/mut_key.rs:81:5
42
65
|
43
66
LL | let _map = HashMap::<Vec<Cell<usize>>, usize>::new();
44
67
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68
+ |
69
+ = note: ... because it contains `Vec<Cell<usize>>`, which has interior mutability
70
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
71
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
45
72
46
73
error: mutable key type
47
74
--> tests/ui/mut_key.rs:83:5
48
75
|
49
76
LL | let _map = HashMap::<BTreeMap<Cell<usize>, ()>, usize>::new();
50
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78
+ |
79
+ = note: ... because it contains `BTreeMap<Cell<usize>, ()>`, which has interior mutability
80
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
81
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
51
82
52
83
error: mutable key type
53
84
--> tests/ui/mut_key.rs:85:5
54
85
|
55
86
LL | let _map = HashMap::<BTreeMap<(), Cell<usize>>, usize>::new();
56
87
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
+ |
89
+ = note: ... because it contains `BTreeMap<(), Cell<usize>>`, which has interior mutability
90
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
91
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
57
92
58
93
error: mutable key type
59
94
--> tests/ui/mut_key.rs:87:5
60
95
|
61
96
LL | let _map = HashMap::<BTreeSet<Cell<usize>>, usize>::new();
62
97
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98
+ |
99
+ = note: ... because it contains `BTreeSet<Cell<usize>>`, which has interior mutability
100
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
101
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
63
102
64
103
error: mutable key type
65
104
--> tests/ui/mut_key.rs:89:5
66
105
|
67
106
LL | let _map = HashMap::<Option<Cell<usize>>, usize>::new();
68
107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
108
+ |
109
+ = note: ... because it contains `Option<Cell<usize>>`, which has interior mutability
110
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
111
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
69
112
70
113
error: mutable key type
71
114
--> tests/ui/mut_key.rs:91:5
72
115
|
73
116
LL | let _map = HashMap::<Option<Vec<Cell<usize>>>, usize>::new();
74
117
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118
+ |
119
+ = note: ... because it contains `Option<Vec<Cell<usize>>>`, which has interior mutability
120
+ = note: ... because it contains `Vec<Cell<usize>>`, which has interior mutability
121
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
122
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
75
123
76
124
error: mutable key type
77
125
--> tests/ui/mut_key.rs:94:5
78
126
|
79
127
LL | let _map = HashMap::<Box<Cell<usize>>, usize>::new();
80
128
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129
+ |
130
+ = note: ... because it contains `Box<Cell<usize>>`, which has interior mutability
131
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
132
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
81
133
82
134
error: mutable key type
83
135
--> tests/ui/mut_key.rs:96:5
84
136
|
85
137
LL | let _map = HashMap::<Rc<Cell<usize>>, usize>::new();
86
138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139
+ |
140
+ = note: ... because it contains `Rc<Cell<usize>>`, which has interior mutability
141
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
142
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
87
143
88
144
error: mutable key type
89
145
--> tests/ui/mut_key.rs:98:5
90
146
|
91
147
LL | let _map = HashMap::<Arc<Cell<usize>>, usize>::new();
92
148
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149
+ |
150
+ = note: ... because it contains `Arc<Cell<usize>>`, which has interior mutability
151
+ = note: ... because it contains `Cell<usize>`, which has interior mutability
152
+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
93
153
94
154
error: aborting due to 15 previous errors
95
155
0 commit comments