rust/tests/ui/declare_interior_mutable_const/enums.stderr

91 lines
3.5 KiB
Plaintext
Raw Normal View History

error: a `const` item should never be interior mutable
--> $DIR/enums.rs:12:1
|
2023-04-20 10:19:36 -05:00
LL | const UNFROZEN_VARIANT: OptionalCell = OptionalCell::Unfrozen(Cell::new(true));
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| 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/enums.rs:23:1
|
2023-04-20 10:19:36 -05:00
LL | const UNFROZEN_VARIANT_FROM_FN: OptionalCell = unfrozen_variant();
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| make this a static item (maybe with lazy_static)
error: a `const` item should never be interior mutable
--> $DIR/enums.rs:45:1
|
LL | const NESTED_UNFROZEN_VARIANT: NestedOutermost = NestedOutermost {
| ^----
| |
| _make this a static item (maybe with lazy_static)
| |
2023-04-20 10:19:36 -05:00
LL | |
LL | | outer: NestedOuter::NestedInner(NestedInner {
LL | | inner: NestedInnermost::Unfrozen(AtomicUsize::new(2)),
LL | | }),
2023-04-20 10:19:36 -05:00
LL | | };
| |__^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:60:5
|
2023-04-20 10:19:36 -05:00
LL | const TO_BE_UNFROZEN_VARIANT: OptionalCell;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:61:5
|
2023-04-20 10:19:36 -05:00
LL | const TO_BE_FROZEN_VARIANT: OptionalCell;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:64:5
|
2023-04-20 10:19:36 -05:00
LL | const DEFAULTED_ON_UNFROZEN_VARIANT: OptionalCell = OptionalCell::Unfrozen(Cell::new(false));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:90:5
|
2023-04-20 10:19:36 -05:00
LL | const TO_BE_UNFROZEN_VARIANT: Option<Self::ToBeUnfrozen> = Some(Self::ToBeUnfrozen::new(4));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:102:5
|
2023-04-20 10:19:36 -05:00
LL | const UNFROZEN_VARIANT: BothOfCellAndGeneric<T> = BothOfCellAndGeneric::Unfrozen(Cell::new(std::ptr::null()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:105:5
|
2023-04-20 10:19:36 -05:00
LL | const GENERIC_VARIANT: BothOfCellAndGeneric<T> = BothOfCellAndGeneric::Generic(std::ptr::null());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:111:5
|
2023-04-20 10:19:36 -05:00
LL | const NO_ENUM: Cell<*const T> = Cell::new(std::ptr::null());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:118:5
|
LL | / const UNFROZEN_VARIANT: BothOfCellAndGeneric<Self::AssocType> =
2023-04-20 10:19:36 -05:00
LL | | BothOfCellAndGeneric::Unfrozen(Cell::new(std::ptr::null()));
| |____________________________________________________________________^
error: a `const` item should never be interior mutable
2023-04-20 10:19:36 -05:00
--> $DIR/enums.rs:120:5
|
2023-04-20 10:19:36 -05:00
LL | const GENERIC_VARIANT: BothOfCellAndGeneric<Self::AssocType> = BothOfCellAndGeneric::Generic(std::ptr::null());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors