mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 11:03:16 +00:00
50 lines
2 KiB
Text
50 lines
2 KiB
Text
error: a `const` item should not be interior mutable
|
|
--> tests/ui/declare_interior_mutable_const/others.rs:10:1
|
|
|
|
|
LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: consider making this a static item
|
|
= note: `-D clippy::declare-interior-mutable-const` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::declare_interior_mutable_const)]`
|
|
|
|
error: a `const` item should not be interior mutable
|
|
--> tests/ui/declare_interior_mutable_const/others.rs:11:1
|
|
|
|
|
LL | const CELL: Cell<usize> = Cell::new(6);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: consider making this `Sync` so that it can go in a static item or using a `thread_local`
|
|
|
|
error: a `const` item should not be interior mutable
|
|
--> tests/ui/declare_interior_mutable_const/others.rs:12:1
|
|
|
|
|
LL | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: consider making this a static item
|
|
|
|
error: a `const` item should not be interior mutable
|
|
--> tests/ui/declare_interior_mutable_const/others.rs:17:9
|
|
|
|
|
LL | const $name: $ty = $e;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | declare_const!(_ONCE: Once = Once::new());
|
|
| ----------------------------------------- in this macro invocation
|
|
|
|
|
= note: this error originates in the macro `declare_const` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: a `const` item should not be interior mutable
|
|
--> tests/ui/declare_interior_mutable_const/others.rs:45:13
|
|
|
|
|
LL | const _BAZ: Cell<usize> = Cell::new(0);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | issue_8493!();
|
|
| ------------- in this macro invocation
|
|
|
|
|
= note: this error originates in the macro `issue_8493` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: aborting due to 5 previous errors
|
|
|