rust/tests/ui/non_copy_const.stderr

260 lines
8.8 KiB
Plaintext
Raw Normal View History

error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:10:1
|
2018-12-27 09:57:55 -06:00
LL | 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:11:1
|
2018-12-27 09:57:55 -06:00
LL | 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:12:1
|
2018-12-27 09:57:55 -06:00
LL | 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:17:9
|
2018-12-27 09:57:55 -06:00
LL | const $name: $ty = $e;
2018-12-09 23:27:19 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^
...
2018-12-27 09:57:55 -06:00
LL | 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:41:5
|
2018-12-27 09:57:55 -06:00
LL | const ATOMIC: AtomicUsize; //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:45:5
|
2018-12-27 09:57:55 -06:00
LL | const INPUT: T;
| ^^^^^^^^^^^^^^^
|
help: consider requiring `T` to be `Copy`
--> $DIR/non_copy_const.rs:45:18
|
2018-12-27 09:57:55 -06:00
LL | const INPUT: T;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:48:5
|
2018-12-27 09:57:55 -06:00
LL | const ASSOC: Self::NonCopyType;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `<Self as Trait<T>>::NonCopyType` to be `Copy`
--> $DIR/non_copy_const.rs:48:18
|
2018-12-27 09:57:55 -06:00
LL | const ASSOC: Self::NonCopyType;
| ^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:52:5
|
2018-12-27 09:57:55 -06:00
LL | const AN_INPUT: T = Self::INPUT;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `T` to be `Copy`
--> $DIR/non_copy_const.rs:52:21
|
2018-12-27 09:57:55 -06:00
LL | const AN_INPUT: T = Self::INPUT;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:17:9
|
2018-12-27 09:57:55 -06:00
LL | const $name: $ty = $e;
2018-12-09 23:27:19 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^
...
2018-12-27 09:57:55 -06:00
LL | 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:61:5
|
2018-12-27 09:57:55 -06:00
LL | const SELF_2: Self;
| ^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `Self` to be `Copy`
--> $DIR/non_copy_const.rs:61:19
|
2018-12-27 09:57:55 -06:00
LL | const SELF_2: Self;
| ^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:82:5
|
2018-12-27 09:57:55 -06:00
LL | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:85:5
|
2018-12-27 09:57:55 -06:00
LL | const U_SELF: U = U::SELF_2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `U` to be `Copy`
--> $DIR/non_copy_const.rs:85:19
|
2018-12-27 09:57:55 -06:00
LL | const U_SELF: U = U::SELF_2;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:88:5
|
2018-12-27 09:57:55 -06:00
LL | const T_ASSOC: T::NonCopyType = T::ASSOC;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `<T as Trait<u32>>::NonCopyType` to be `Copy`
--> $DIR/non_copy_const.rs:88:20
|
2018-12-27 09:57:55 -06:00
LL | const T_ASSOC: T::NonCopyType = T::ASSOC;
| ^^^^^^^^^^^^^^
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:95:5
2018-12-27 09:57:55 -06:00
|
LL | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^
|
= note: `#[deny(clippy::borrow_interior_mutable_const)]` on by default
2018-12-27 09:57:55 -06: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
--> $DIR/non_copy_const.rs:96:16
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:99:22
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:100:25
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:101:27
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:102:26
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:113:14
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:114:14
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:115:19
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:116:14
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:117:13
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:123:13
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:128:5
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:129:16
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:142:5
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
--> $DIR/non_copy_const.rs:143:16
2018-12-27 09:57:55 -06:00
|
LL | 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
2019-01-28 03:17:04 -06:00
error: aborting due to 29 previous errors