rust-clippy/tests/ui/non_copy_const.stderr
2018-12-10 08:22:07 +01:00

275 lines
9.5 KiB
Text

error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:19:1
|
19 | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: make this a static item: `static`
|
= note: #[deny(clippy::declare_interior_mutable_const)] on by default
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:20:1
|
20 | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: make this a static item: `static`
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:21:1
|
21 | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7);
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: make this a static item: `static`
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:26:9
|
26 | const $name: $ty = $e;
| ^^^^^^^^^^^^^^^^^^^^^^
...
29 | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
| ------------------------------------------ in this macro invocation
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:50:5
|
50 | const ATOMIC: AtomicUsize; //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:54:5
|
54 | const INPUT: T;
| ^^^^^^^^^^^^^^^
|
help: consider requiring `T` to be `Copy`
--> $DIR/non_copy_const.rs:54:18
|
54 | const INPUT: T;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:57:5
|
57 | const ASSOC: Self::NonCopyType;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `<Self as Trait<T>>::NonCopyType` to be `Copy`
--> $DIR/non_copy_const.rs:57:18
|
57 | const ASSOC: Self::NonCopyType;
| ^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:61:5
|
61 | const AN_INPUT: T = Self::INPUT;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `T` to be `Copy`
--> $DIR/non_copy_const.rs:61:21
|
61 | const AN_INPUT: T = Self::INPUT;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:26:9
|
26 | const $name: $ty = $e;
| ^^^^^^^^^^^^^^^^^^^^^^
...
64 | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable
| ----------------------------------------------- in this macro invocation
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:70:5
|
70 | const SELF_2: Self;
| ^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `Self` to be `Copy`
--> $DIR/non_copy_const.rs:70:19
|
70 | const SELF_2: Self;
| ^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:91:5
|
91 | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:94:5
|
94 | const U_SELF: U = U::SELF_2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `U` to be `Copy`
--> $DIR/non_copy_const.rs:94:19
|
94 | const U_SELF: U = U::SELF_2;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:97:5
|
97 | const T_ASSOC: T::NonCopyType = T::ASSOC;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `<T as Trait<u32>>::NonCopyType` to be `Copy`
--> $DIR/non_copy_const.rs:97:20
|
97 | const T_ASSOC: T::NonCopyType = T::ASSOC;
| ^^^^^^^^^^^^^^
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:104:5
|
104 | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^
|
= note: #[deny(clippy::borrow_interior_mutable_const)] on by default
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:105:16
|
105 | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability
| ^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:107:5
|
107 | ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:108:16
|
108 | assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability
| ^^^^^^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:111:22
|
111 | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:112:25
|
112 | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:113:27
|
113 | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:114:26
|
114 | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:125:14
|
125 | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
| ^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:126:14
|
126 | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
| ^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:127:19
|
127 | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
| ^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:128:14
|
128 | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
| ^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:129:13
|
129 | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:135:13
|
135 | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
| ^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:140:5
|
140 | CELL.set(2); //~ ERROR interior mutability
| ^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:141:16
|
141 | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
| ^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:154:5
|
154 | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:155:16
|
155 | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability
| ^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: aborting due to 31 previous errors