mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-23 03:23:33 +00:00
110 lines
4.5 KiB
Text
110 lines
4.5 KiB
Text
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:9:1
|
|
|
|
|
LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
|
|
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
| |
|
|
| make this a static item (maybe with lazy_static)
|
|
|
|
|
= note: `-D clippy::declare-interior-mutable-const` implied by `-D warnings`
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:10:1
|
|
|
|
|
LL | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
|
|
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
| |
|
|
| make this a static item (maybe with lazy_static)
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:11:1
|
|
|
|
|
LL | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7);
|
|
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
| |
|
|
| make this a static item (maybe with lazy_static)
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:16:9
|
|
|
|
|
LL | const $name: $ty = $e;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
|
|
| ------------------------------------------ in this macro invocation
|
|
|
|
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:39:5
|
|
|
|
|
LL | const ATOMIC: AtomicUsize; //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:16:9
|
|
|
|
|
LL | const $name: $ty = $e;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | declare_const!(ANOTHER_ATOMIC: AtomicUsize = Self::ATOMIC); //~ ERROR interior mutable
|
|
| ----------------------------------------------------------- in this macro invocation
|
|
|
|
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:67:5
|
|
|
|
|
LL | const TO_BE_CONCRETE: AtomicUsize = AtomicUsize::new(11); //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:92:5
|
|
|
|
|
LL | const TO_BE_UNFROZEN: Self::ToBeUnfrozen = AtomicUsize::new(13); //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:93:5
|
|
|
|
|
LL | const WRAPPED_TO_BE_UNFROZEN: Wrapper<Self::ToBeUnfrozen> = Wrapper(AtomicUsize::new(14)); //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:112:5
|
|
|
|
|
LL | const BOUNDED: T::ToBeBounded; //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:140:5
|
|
|
|
|
LL | const SELF: Self = AtomicUsize::new(17); //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:141:5
|
|
|
|
|
LL | const WRAPPED_SELF: Option<Self> = Some(AtomicUsize::new(21)); //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:149:5
|
|
|
|
|
LL | const INDIRECT: Cell<*const T>; //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:165:5
|
|
|
|
|
LL | const ATOMIC: AtomicUsize = AtomicUsize::new(18); //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: a `const` item should never be interior mutable
|
|
--> $DIR/declare_interior_mutable_const.rs:171:5
|
|
|
|
|
LL | const BOUNDED_ASSOC_TYPE: T::ToBeBounded = AtomicUsize::new(19); //~ ERROR interior mutable
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 15 previous errors
|
|
|