error[E0796]: creating a shared reference to a mutable static
--> $DIR/reference-to-mut-static.rs:16:18
|
LL | let _y = &X;
| ^^ shared reference to mutable static
|
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
help: use `addr_of!` instead to create a raw pointer
error[E0796]: creating a mutable reference to a mutable static
--> $DIR/reference-to-mut-static.rs:20:18
|
LL | let _y = &mut X;
| ^^^^^^ mutable reference to mutable static
|
= note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
help: use `addr_of_mut!` instead to create a raw pointer
error[E0796]: creating a shared reference to a mutable static
--> $DIR/reference-to-mut-static.rs:28:22
|
LL | let ref _a = X;
| ^ shared reference to mutable static
|
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
help: use `addr_of!` instead to create a raw pointer
error[E0796]: creating a shared reference to a mutable static
--> $DIR/reference-to-mut-static.rs:32:25
|
LL | let (_b, _c) = (&X, &Y);
| ^^ shared reference to mutable static
|
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
help: use `addr_of!` instead to create a raw pointer
error[E0796]: creating a shared reference to a mutable static
--> $DIR/reference-to-mut-static.rs:32:29
|
LL | let (_b, _c) = (&X, &Y);
| ^^ shared reference to mutable static
|
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
help: use `addr_of!` instead to create a raw pointer
error[E0796]: creating a shared reference to a mutable static
--> $DIR/reference-to-mut-static.rs:38:13
|
LL | foo(&X);
| ^^ shared reference to mutable static
|
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
help: use `addr_of!` instead to create a raw pointer