@@ -4,6 +4,9 @@ error: mutable key type
44LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
55 | ^^^^^^^^^^^^^^^^^^^^^^^^
66 |
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
710 = note: `-D clippy::mutable-key-type` implied by `-D warnings`
811 = help: to override `-D warnings` add `#[allow(clippy::mutable_key_type)]`
912
@@ -12,84 +15,141 @@ error: mutable key type
1215 |
1316LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
1417 | ^^^^^^^^^^^^
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
1522
1623error: mutable key type
1724 --> tests/ui/mut_key.rs:35:5
1825 |
1926LL | let _other: HashMap<Key, bool> = HashMap::new();
2027 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
2132
2233error: mutable key type
2334 --> tests/ui/mut_key.rs:63:22
2435 |
2536LL | fn tuples_bad<U>(_m: &mut HashMap<(Key, U), bool>) {}
2637 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
2743
2844error: mutable key type
2945 --> tests/ui/mut_key.rs:76:5
3046 |
3147LL | let _map = HashMap::<Cell<usize>, usize>::new();
3248 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49+ |
50+ = note: ... because it contains `Cell<usize>`, which has interior mutability
51+ = note: ... because it contains `UnsafeCell<usize>`, which has interior mutability
3352
3453error: mutable key type
3554 --> tests/ui/mut_key.rs:78:5
3655 |
3756LL | let _map = HashMap::<&mut Cell<usize>, usize>::new();
3857 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
3962
4063error: mutable key type
4164 --> tests/ui/mut_key.rs:81:5
4265 |
4366LL | let _map = HashMap::<Vec<Cell<usize>>, usize>::new();
4467 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
4572
4673error: mutable key type
4774 --> tests/ui/mut_key.rs:83:5
4875 |
4976LL | let _map = HashMap::<BTreeMap<Cell<usize>, ()>, usize>::new();
5077 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
5182
5283error: mutable key type
5384 --> tests/ui/mut_key.rs:85:5
5485 |
5586LL | let _map = HashMap::<BTreeMap<(), Cell<usize>>, usize>::new();
5687 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
5792
5893error: mutable key type
5994 --> tests/ui/mut_key.rs:87:5
6095 |
6196LL | let _map = HashMap::<BTreeSet<Cell<usize>>, usize>::new();
6297 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
63102
64103error: mutable key type
65104 --> tests/ui/mut_key.rs:89:5
66105 |
67106LL | let _map = HashMap::<Option<Cell<usize>>, usize>::new();
68107 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
69112
70113error: mutable key type
71114 --> tests/ui/mut_key.rs:91:5
72115 |
73116LL | let _map = HashMap::<Option<Vec<Cell<usize>>>, usize>::new();
74117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
75123
76124error: mutable key type
77125 --> tests/ui/mut_key.rs:94:5
78126 |
79127LL | let _map = HashMap::<Box<Cell<usize>>, usize>::new();
80128 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
81133
82134error: mutable key type
83135 --> tests/ui/mut_key.rs:96:5
84136 |
85137LL | let _map = HashMap::<Rc<Cell<usize>>, usize>::new();
86138 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
87143
88144error: mutable key type
89145 --> tests/ui/mut_key.rs:98:5
90146 |
91147LL | let _map = HashMap::<Arc<Cell<usize>>, usize>::new();
92148 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
93153
94154error: aborting due to 15 previous errors
95155
0 commit comments