rust/tests/ui/borrow_interior_mutable_const/projections.stderr
2025-02-01 02:30:50 +03:00

44 lines
1.7 KiB
Text

error: a `const` item should not be interior mutable
--> tests/ui/borrow_interior_mutable_const/projections.rs:27:1
|
LL | const CELL: Assoc<u8> = UnsafeCell::new(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider making this `Sync` so that it can go in a static item or using a `thread_local`
note: the lint level is defined here
--> tests/ui/borrow_interior_mutable_const/projections.rs:2:9
|
LL | #![deny(clippy::declare_interior_mutable_const)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item should not be interior mutable
--> tests/ui/borrow_interior_mutable_const/projections.rs:29:1
|
LL | const MUTABLE: MaybeMutable = MaybeMutable::Mutable(CELL);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider making this `Sync` so that it can go in a static item or using a `thread_local`
error: a `const` item with interior mutability should not be borrowed
--> tests/ui/borrow_interior_mutable_const/projections.rs:38:16
|
LL | print_ref(&CELL);
| ^^^^
|
= help: assign this const to a local or static variable, and use the variable here
note: the lint level is defined here
--> tests/ui/borrow_interior_mutable_const/projections.rs:1:9
|
LL | #![deny(clippy::borrow_interior_mutable_const)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a `const` item with interior mutability should not be borrowed
--> tests/ui/borrow_interior_mutable_const/projections.rs:40:16
|
LL | print_ref(&MUTABLE);
| ^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: aborting due to 4 previous errors