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