1 error: a `const` item should never be interior mutable
4 LL | const UNFROZEN_VARIANT: OptionalCell = OptionalCell::Unfrozen(Cell::new(true)); //~ ERROR interior mutable
5 | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 | make this a static item (maybe with lazy_static)
9 = note: `-D clippy::declare-interior-mutable-const` implied by `-D warnings`
11 error: a `const` item should never be interior mutable
12 --> $DIR/enums.rs:23:1
14 LL | const UNFROZEN_VARIANT_FROM_FN: OptionalCell = unfrozen_variant(); //~ ERROR interior mutable
15 | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 | make this a static item (maybe with lazy_static)
19 error: a `const` item should never be interior mutable
20 --> $DIR/enums.rs:45:1
22 LL | const NESTED_UNFROZEN_VARIANT: NestedOutermost = NestedOutermost {
25 | _make this a static item (maybe with lazy_static)
27 LL | | outer: NestedOuter::NestedInner(NestedInner {
28 LL | | inner: NestedInnermost::Unfrozen(AtomicUsize::new(2)),
30 LL | | }; //~ ERROR interior mutable
33 error: a `const` item should never be interior mutable
34 --> $DIR/enums.rs:59:5
36 LL | const TO_BE_UNFROZEN_VARIANT: OptionalCell; //~ ERROR interior mutable
37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39 error: a `const` item should never be interior mutable
40 --> $DIR/enums.rs:60:5
42 LL | const TO_BE_FROZEN_VARIANT: OptionalCell; //~ ERROR interior mutable
43 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 error: a `const` item should never be interior mutable
46 --> $DIR/enums.rs:63:5
48 LL | const DEFAULTED_ON_UNFROZEN_VARIANT: OptionalCell = OptionalCell::Unfrozen(Cell::new(false)); //~ ERROR interior mutable
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51 error: a `const` item should never be interior mutable
52 --> $DIR/enums.rs:89:5
54 LL | const TO_BE_UNFROZEN_VARIANT: Option<Self::ToBeUnfrozen> = Some(Self::ToBeUnfrozen::new(4)); //~ ERROR interior mutable
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57 error: a `const` item should never be interior mutable
58 --> $DIR/enums.rs:101:5
60 LL | const UNFROZEN_VARIANT: BothOfCellAndGeneric<T> = BothOfCellAndGeneric::Unfrozen(Cell::new(std::ptr::null())); //~ ERROR interior mut...
61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 error: a `const` item should never be interior mutable
64 --> $DIR/enums.rs:104:5
66 LL | const GENERIC_VARIANT: BothOfCellAndGeneric<T> = BothOfCellAndGeneric::Generic(std::ptr::null()); //~ ERROR interior mutable
67 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69 error: a `const` item should never be interior mutable
70 --> $DIR/enums.rs:110:5
72 LL | const NO_ENUM: Cell<*const T> = Cell::new(std::ptr::null()); //~ ERROR interior mutable
73 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75 error: a `const` item should never be interior mutable
76 --> $DIR/enums.rs:117:5
78 LL | / const UNFROZEN_VARIANT: BothOfCellAndGeneric<Self::AssocType> =
79 LL | | BothOfCellAndGeneric::Unfrozen(Cell::new(std::ptr::null())); //~ ERROR interior mutable
80 | |____________________________________________________________________^
82 error: a `const` item should never be interior mutable
83 --> $DIR/enums.rs:119:5
85 LL | const GENERIC_VARIANT: BothOfCellAndGeneric<Self::AssocType> = BothOfCellAndGeneric::Generic(std::ptr::null()); //~ ERROR interior mu...
86 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 error: aborting due to 12 previous errors