2018-06-06 17:20:22 +02:00
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:12:1
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
12 | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
|
2018-06-06 17:20:22 +02:00
|
|
|
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| help: make this a static item: `static`
|
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
= note: #[deny(clippy::declare_interior_mutable_const)] on by default
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:13:1
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
13 | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
|
2018-06-06 17:20:22 +02:00
|
|
|
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| help: make this a static item: `static`
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:14:1
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
14 | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7);
|
2018-06-06 17:20:22 +02:00
|
|
|
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| help: make this a static item: `static`
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:18:42
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
18 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; };
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
2018-08-01 16:30:44 +02:00
|
|
|
19 | }
|
|
|
|
20 | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
|
2018-06-06 17:20:22 +02:00
|
|
|
| ------------------------------------------ in this macro invocation
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:41:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
41 | const ATOMIC: AtomicUsize; //~ ERROR interior mutable
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:45:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
45 | const INPUT: T;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider requiring `T` to be `Copy`
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:45:18
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
45 | const INPUT: T;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:48:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
48 | const ASSOC: Self::NonCopyType;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider requiring `<Self as Trait<T>>::NonCopyType` to be `Copy`
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:48:18
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
48 | const ASSOC: Self::NonCopyType;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:52:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
52 | const AN_INPUT: T = Self::INPUT;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider requiring `T` to be `Copy`
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:52:21
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
52 | const AN_INPUT: T = Self::INPUT;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:18:42
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
18 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; };
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
...
|
2018-08-01 16:30:44 +02:00
|
|
|
55 | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable
|
2018-06-06 17:20:22 +02:00
|
|
|
| ----------------------------------------------- in this macro invocation
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:61:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
61 | const SELF_2: Self;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider requiring `Self` to be `Copy`
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:61:19
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
61 | const SELF_2: Self;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:82:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
82 | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:85:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
85 | const U_SELF: U = U::SELF_2;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider requiring `U` to be `Copy`
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:85:19
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
85 | const U_SELF: U = U::SELF_2;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^
|
|
|
|
|
|
|
|
error: a const item should never be interior mutable
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:88:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
88 | const T_ASSOC: T::NonCopyType = T::ASSOC;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider requiring `<T as Trait<u32>>::NonCopyType` to be `Copy`
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:88:20
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
88 | const T_ASSOC: T::NonCopyType = T::ASSOC;
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: a const item with interior mutability should not be borrowed
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:95:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
95 | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
= note: #[deny(clippy::borrow_interior_mutable_const)] on by default
|
2018-06-06 17:20:22 +02:00
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:96:16
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
96 | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:98:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
98 | ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:99:16
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
99 | assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:102:22
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
102 | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:103:25
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
103 | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:104:27
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
104 | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:105:26
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
105 | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:116:14
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
116 | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:117:14
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
117 | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:118:19
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
118 | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:119:14
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
119 | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:120:13
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
120 | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:126:13
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
126 | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:131:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
131 | CELL.set(2); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:132:16
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
132 | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:145:5
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
145 | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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
|
2018-08-01 16:30:44 +02:00
|
|
|
--> $DIR/non_copy_const.rs:146:16
|
2018-06-06 17:20:22 +02:00
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
146 | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability
|
2018-06-06 17:20:22 +02:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: assign this const to a local or static variable, and use the variable here
|
|
|
|
|
|
|
|
error: aborting due to 31 previous errors
|
|
|
|
|