]> git.lizzy.rs Git - rust.git/blob - tests/ui/non_copy_const.stderr
Auto merge of #4575 - Manishearth:suggestions, r=oli-obk
[rust.git] / tests / ui / non_copy_const.stderr
1 error: a const item should never be interior mutable
2   --> $DIR/non_copy_const.rs:9:1
3    |
4 LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
5    | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    | |
7    | make this a static item (maybe with lazy_static)
8    |
9    = note: `#[deny(clippy::declare_interior_mutable_const)]` on by default
10
11 error: a const item should never be interior mutable
12   --> $DIR/non_copy_const.rs:10:1
13    |
14 LL | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
15    | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16    | |
17    | make this a static item (maybe with lazy_static)
18
19 error: a const item should never be interior mutable
20   --> $DIR/non_copy_const.rs:11:1
21    |
22 LL | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7);
23    | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24    | |
25    | make this a static item (maybe with lazy_static)
26
27 error: a const item should never be interior mutable
28   --> $DIR/non_copy_const.rs:16:9
29    |
30 LL |         const $name: $ty = $e;
31    |         ^^^^^^^^^^^^^^^^^^^^^^
32 ...
33 LL | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
34    | ------------------------------------------ in this macro invocation
35
36 error: a const item should never be interior mutable
37   --> $DIR/non_copy_const.rs:40:5
38    |
39 LL |     const ATOMIC: AtomicUsize; //~ ERROR interior mutable
40    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
41
42 error: a const item should never be interior mutable
43   --> $DIR/non_copy_const.rs:44:5
44    |
45 LL |     const INPUT: T;
46    |     ^^^^^^^^^^^^^-^
47    |                  |
48    |                  consider requiring `T` to be `Copy`
49
50 error: a const item should never be interior mutable
51   --> $DIR/non_copy_const.rs:47:5
52    |
53 LL |     const ASSOC: Self::NonCopyType;
54    |     ^^^^^^^^^^^^^-----------------^
55    |                  |
56    |                  consider requiring `<Self as Trait<T>>::NonCopyType` to be `Copy`
57
58 error: a const item should never be interior mutable
59   --> $DIR/non_copy_const.rs:51:5
60    |
61 LL |     const AN_INPUT: T = Self::INPUT;
62    |     ^^^^^^^^^^^^^^^^-^^^^^^^^^^^^^^^
63    |                     |
64    |                     consider requiring `T` to be `Copy`
65
66 error: a const item should never be interior mutable
67   --> $DIR/non_copy_const.rs:16:9
68    |
69 LL |         const $name: $ty = $e;
70    |         ^^^^^^^^^^^^^^^^^^^^^^
71 ...
72 LL |     declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable
73    |     ----------------------------------------------- in this macro invocation
74
75 error: a const item should never be interior mutable
76   --> $DIR/non_copy_const.rs:60:5
77    |
78 LL |     const SELF_2: Self;
79    |     ^^^^^^^^^^^^^^----^
80    |                   |
81    |                   consider requiring `Self` to be `Copy`
82
83 error: a const item should never be interior mutable
84   --> $DIR/non_copy_const.rs:81:5
85    |
86 LL |     const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable
87    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
89 error: a const item should never be interior mutable
90   --> $DIR/non_copy_const.rs:84:5
91    |
92 LL |     const U_SELF: U = U::SELF_2;
93    |     ^^^^^^^^^^^^^^-^^^^^^^^^^^^^
94    |                   |
95    |                   consider requiring `U` to be `Copy`
96
97 error: a const item should never be interior mutable
98   --> $DIR/non_copy_const.rs:87:5
99    |
100 LL |     const T_ASSOC: T::NonCopyType = T::ASSOC;
101    |     ^^^^^^^^^^^^^^^--------------^^^^^^^^^^^^
102    |                    |
103    |                    consider requiring `<T as Trait<u32>>::NonCopyType` to be `Copy`
104
105 error: a const item with interior mutability should not be borrowed
106   --> $DIR/non_copy_const.rs:94:5
107    |
108 LL |     ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
109    |     ^^^^^^
110    |
111    = note: `#[deny(clippy::borrow_interior_mutable_const)]` on by default
112    = help: assign this const to a local or static variable, and use the variable here
113
114 error: a const item with interior mutability should not be borrowed
115   --> $DIR/non_copy_const.rs:95:16
116    |
117 LL |     assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability
118    |                ^^^^^^
119    |
120    = help: assign this const to a local or static variable, and use the variable here
121
122 error: a const item with interior mutability should not be borrowed
123   --> $DIR/non_copy_const.rs:98:22
124    |
125 LL |     let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
126    |                      ^^^^^^^^^
127    |
128    = help: assign this const to a local or static variable, and use the variable here
129
130 error: a const item with interior mutability should not be borrowed
131   --> $DIR/non_copy_const.rs:99:25
132    |
133 LL |     let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
134    |                         ^^^^^^^^^
135    |
136    = help: assign this const to a local or static variable, and use the variable here
137
138 error: a const item with interior mutability should not be borrowed
139   --> $DIR/non_copy_const.rs:100:27
140    |
141 LL |     let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
142    |                           ^^^^^^^^^
143    |
144    = help: assign this const to a local or static variable, and use the variable here
145
146 error: a const item with interior mutability should not be borrowed
147   --> $DIR/non_copy_const.rs:101:26
148    |
149 LL |     let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
150    |                          ^^^^^^^^^
151    |
152    = help: assign this const to a local or static variable, and use the variable here
153
154 error: a const item with interior mutability should not be borrowed
155   --> $DIR/non_copy_const.rs:112:14
156    |
157 LL |     let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
158    |              ^^^^^^^^^^^^
159    |
160    = help: assign this const to a local or static variable, and use the variable here
161
162 error: a const item with interior mutability should not be borrowed
163   --> $DIR/non_copy_const.rs:113:14
164    |
165 LL |     let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
166    |              ^^^^^^^^^^^^
167    |
168    = help: assign this const to a local or static variable, and use the variable here
169
170 error: a const item with interior mutability should not be borrowed
171   --> $DIR/non_copy_const.rs:114:19
172    |
173 LL |     let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
174    |                   ^^^^^^^^^^^^
175    |
176    = help: assign this const to a local or static variable, and use the variable here
177
178 error: a const item with interior mutability should not be borrowed
179   --> $DIR/non_copy_const.rs:115:14
180    |
181 LL |     let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
182    |              ^^^^^^^^^^^^
183    |
184    = help: assign this const to a local or static variable, and use the variable here
185
186 error: a const item with interior mutability should not be borrowed
187   --> $DIR/non_copy_const.rs:116:13
188    |
189 LL |     let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability
190    |             ^^^^^^^^^^^^
191    |
192    = help: assign this const to a local or static variable, and use the variable here
193
194 error: a const item with interior mutability should not be borrowed
195   --> $DIR/non_copy_const.rs:122:13
196    |
197 LL |     let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
198    |             ^^^^^^^^^^^^
199    |
200    = help: assign this const to a local or static variable, and use the variable here
201
202 error: a const item with interior mutability should not be borrowed
203   --> $DIR/non_copy_const.rs:127:5
204    |
205 LL |     CELL.set(2); //~ ERROR interior mutability
206    |     ^^^^
207    |
208    = help: assign this const to a local or static variable, and use the variable here
209
210 error: a const item with interior mutability should not be borrowed
211   --> $DIR/non_copy_const.rs:128:16
212    |
213 LL |     assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
214    |                ^^^^
215    |
216    = help: assign this const to a local or static variable, and use the variable here
217
218 error: a const item with interior mutability should not be borrowed
219   --> $DIR/non_copy_const.rs:141:5
220    |
221 LL |     u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
222    |     ^^^^^^^^^^^
223    |
224    = help: assign this const to a local or static variable, and use the variable here
225
226 error: a const item with interior mutability should not be borrowed
227   --> $DIR/non_copy_const.rs:142:16
228    |
229 LL |     assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability
230    |                ^^^^^^^^^^^
231    |
232    = help: assign this const to a local or static variable, and use the variable here
233
234 error: aborting due to 29 previous errors
235