rust/tests/ui/non_copy_const.stderr

276 lines
9.7 KiB
Plaintext
Raw Normal View History

error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:22:1
|
2018-10-06 18:18:06 +02:00
22 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:23:1
|
2018-10-06 18:18:06 +02:00
23 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:24:1
|
2018-10-06 18:18:06 +02:00
24 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:28:42
|
2018-10-06 18:18:06 +02:00
28 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; };
| ^^^^^^^^^^^^^^^^^^^^^^
2018-10-06 18:18:06 +02:00
29 | }
30 | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
| ------------------------------------------ in this macro invocation
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:51:5
|
2018-10-06 18:18:06 +02:00
51 | const ATOMIC: AtomicUsize; //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:55:5
|
2018-10-06 18:18:06 +02:00
55 | const INPUT: T;
| ^^^^^^^^^^^^^^^
|
help: consider requiring `T` to be `Copy`
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:55:18
|
2018-10-06 18:18:06 +02:00
55 | const INPUT: T;
| ^
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:58:5
|
2018-10-06 18:18:06 +02:00
58 | const ASSOC: Self::NonCopyType;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `<Self as Trait<T>>::NonCopyType` to be `Copy`
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:58:18
|
2018-10-06 18:18:06 +02:00
58 | const ASSOC: Self::NonCopyType;
| ^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:62:5
|
2018-10-06 18:18:06 +02:00
62 | const AN_INPUT: T = Self::INPUT;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `T` to be `Copy`
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:62:21
|
2018-10-06 18:18:06 +02:00
62 | const AN_INPUT: T = Self::INPUT;
| ^
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:28:42
|
2018-10-06 18:18:06 +02:00
28 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; };
| ^^^^^^^^^^^^^^^^^^^^^^
...
2018-10-06 18:18:06 +02:00
65 | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable
| ----------------------------------------------- in this macro invocation
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:71:5
|
2018-10-06 18:18:06 +02:00
71 | const SELF_2: Self;
| ^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `Self` to be `Copy`
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:71:19
|
2018-10-06 18:18:06 +02:00
71 | const SELF_2: Self;
| ^^^^
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:92:5
|
2018-10-06 18:18:06 +02:00
92 | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:95:5
|
2018-10-06 18:18:06 +02:00
95 | const U_SELF: U = U::SELF_2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `U` to be `Copy`
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:95:19
|
2018-10-06 18:18:06 +02:00
95 | const U_SELF: U = U::SELF_2;
| ^
error: a const item should never be interior mutable
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:98:5
|
2018-10-06 18:18:06 +02:00
98 | const T_ASSOC: T::NonCopyType = T::ASSOC;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `<T as Trait<u32>>::NonCopyType` to be `Copy`
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:98:20
|
2018-10-06 18:18:06 +02:00
98 | const T_ASSOC: T::NonCopyType = T::ASSOC;
| ^^^^^^^^^^^^^^
error: a const item with interior mutability should not be borrowed
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:105:5
|
105 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:106:16
|
106 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:108:5
|
108 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:109:16
|
109 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:112:22
|
2018-10-06 18:18:06 +02:00
112 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:113:25
|
2018-10-06 18:18:06 +02:00
113 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:114:27
|
2018-10-06 18:18:06 +02:00
114 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:115:26
|
2018-10-06 18:18:06 +02:00
115 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:126:14
|
2018-10-06 18:18:06 +02:00
126 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:127:14
|
2018-10-06 18:18:06 +02:00
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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:128:19
|
2018-10-06 18:18:06 +02:00
128 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:129:14
|
2018-10-06 18:18:06 +02:00
129 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:130:13
|
2018-10-06 18:18:06 +02:00
130 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:136:13
|
2018-10-06 18:18:06 +02:00
136 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:141:5
|
2018-10-06 18:18:06 +02:00
141 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:142:16
|
2018-10-06 18:18:06 +02:00
142 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:155:5
|
2018-10-06 18:18:06 +02:00
155 | 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
2018-10-06 18:18:06 +02:00
--> $DIR/non_copy_const.rs:156:16
|
2018-10-06 18:18:06 +02:00
156 | 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