mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
144 lines
7.4 KiB
Plaintext
144 lines
7.4 KiB
Plaintext
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:39:18
|
|
|
|
|
LL | let _y = &X;
|
|
| ^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
= note: `#[deny(static_mut_refs)]` on by default
|
|
help: use `&raw const` instead to create a raw pointer
|
|
|
|
|
LL | let _y = &raw const X;
|
|
| ~~~~~~~~~~
|
|
|
|
error: creating a mutable reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:43:18
|
|
|
|
|
LL | let _y = &mut X;
|
|
| ^^^^^^ mutable reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
|
|
help: use `&raw mut` instead to create a raw pointer
|
|
|
|
|
LL | let _y = &raw mut X;
|
|
| ~~~~~~~~
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:51:22
|
|
|
|
|
LL | let ref _a = X;
|
|
| ^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:55:25
|
|
|
|
|
LL | let (_b, _c) = (&X, &Y);
|
|
| ^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
help: use `&raw const` instead to create a raw pointer
|
|
|
|
|
LL | let (_b, _c) = (&raw const X, &Y);
|
|
| ~~~~~~~~~~
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:55:29
|
|
|
|
|
LL | let (_b, _c) = (&X, &Y);
|
|
| ^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
help: use `&raw const` instead to create a raw pointer
|
|
|
|
|
LL | let (_b, _c) = (&X, &raw const Y);
|
|
| ~~~~~~~~~~
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:61:13
|
|
|
|
|
LL | foo(&X);
|
|
| ^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
help: use `&raw const` instead to create a raw pointer
|
|
|
|
|
LL | foo(&raw const X);
|
|
| ~~~~~~~~~~
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:67:17
|
|
|
|
|
LL | let _ = Z.len();
|
|
| ^^^^^^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:73:33
|
|
|
|
|
LL | let _ = format!("{:?}", Z);
|
|
| ^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:77:18
|
|
|
|
|
LL | let _v = &A.value;
|
|
| ^^^^^^^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
help: use `&raw const` instead to create a raw pointer
|
|
|
|
|
LL | let _v = &raw const A.value;
|
|
| ~~~~~~~~~~
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:81:18
|
|
|
|
|
LL | let _s = &A.s.value;
|
|
| ^^^^^^^^^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
help: use `&raw const` instead to create a raw pointer
|
|
|
|
|
LL | let _s = &raw const A.s.value;
|
|
| ~~~~~~~~~~
|
|
|
|
error: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:85:22
|
|
|
|
|
LL | let ref _v = A.value;
|
|
| ^^^^^^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
|
|
error: creating a mutable reference to mutable static is discouraged
|
|
--> $DIR/static-mut-refs.rs:15:14
|
|
|
|
|
LL | &mut ($x.0)
|
|
| ^^^^^^ mutable reference to mutable static
|
|
...
|
|
LL | let _x = bar!(FOO);
|
|
| --------- in this macro invocation
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
|
|
= note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: aborting due to 12 previous errors
|
|
|