2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:12:1
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const UNFROZEN_VARIANT: OptionalCell = OptionalCell::Unfrozen(Cell::new(true));
|
2024-06-07 12:00:08 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
= help: consider making this `Sync` so that it can go in a static item or using a `thread_local`
|
2020-11-23 12:51:04 +00:00
|
|
|
= note: `-D clippy::declare-interior-mutable-const` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::declare_interior_mutable_const)]`
|
2020-11-23 12:51:04 +00:00
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:23:1
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const UNFROZEN_VARIANT_FROM_FN: OptionalCell = unfrozen_variant();
|
2024-06-07 12:00:08 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider making this `Sync` so that it can go in a static item or using a `thread_local`
|
2020-11-23 12:51:04 +00:00
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:45:1
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
LL | / const NESTED_UNFROZEN_VARIANT: NestedOutermost = NestedOutermost {
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | |
|
2020-11-23 12:51:04 +00:00
|
|
|
LL | | outer: NestedOuter::NestedInner(NestedInner {
|
|
|
|
LL | | inner: NestedInnermost::Unfrozen(AtomicUsize::new(2)),
|
|
|
|
LL | | }),
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | | };
|
2020-11-23 12:51:04 +00:00
|
|
|
| |__^
|
2024-06-07 12:00:08 +00:00
|
|
|
|
|
|
|
|
= help: consider making this a static item
|
2020-11-23 12:51:04 +00:00
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:60:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const TO_BE_UNFROZEN_VARIANT: OptionalCell;
|
2020-11-23 12:51:04 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:61:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const TO_BE_FROZEN_VARIANT: OptionalCell;
|
2020-11-23 12:51:04 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:64:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const DEFAULTED_ON_UNFROZEN_VARIANT: OptionalCell = OptionalCell::Unfrozen(Cell::new(false));
|
2020-11-23 12:51:04 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:90:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const TO_BE_UNFROZEN_VARIANT: Option<Self::ToBeUnfrozen> = Some(Self::ToBeUnfrozen::new(4));
|
2020-11-23 12:51:04 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:102:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const UNFROZEN_VARIANT: BothOfCellAndGeneric<T> = BothOfCellAndGeneric::Unfrozen(Cell::new(std::ptr::null()));
|
2020-11-23 12:51:04 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:105:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const GENERIC_VARIANT: BothOfCellAndGeneric<T> = BothOfCellAndGeneric::Generic(std::ptr::null());
|
2020-11-23 12:51:04 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:111:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const NO_ENUM: Cell<*const T> = Cell::new(std::ptr::null());
|
2020-11-23 12:51:04 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:118:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
|
|
|
LL | / const UNFROZEN_VARIANT: BothOfCellAndGeneric<Self::AssocType> =
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | | BothOfCellAndGeneric::Unfrozen(Cell::new(std::ptr::null()));
|
2020-11-23 12:51:04 +00:00
|
|
|
| |____________________________________________________________________^
|
|
|
|
|
2024-06-07 12:00:08 +00:00
|
|
|
error: a `const` item should not be interior mutable
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/declare_interior_mutable_const/enums.rs:120:5
|
2020-11-23 12:51:04 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | const GENERIC_VARIANT: BothOfCellAndGeneric<Self::AssocType> = BothOfCellAndGeneric::Generic(std::ptr::null());
|
2020-11-23 12:51:04 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: aborting due to 12 previous errors
|
|
|
|
|