1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
error: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:38: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:42: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:50: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:54: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:54: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:60: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:66: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:72: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:76: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:80: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:84: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:14: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
|