You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/ui/static/reference-to-mut-static-unsafe-fn.stderr
+4-6
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,8 @@ LL | let ref _a = X;
20
20
= 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
21
21
help: use `addr_of!` instead to create a raw pointer
22
22
|
23
-
LL - let ref _a = X;
24
-
LL + let ref _a = addr_of!(X);
25
-
|
23
+
LL | let ref _a = addr_of!(X);
24
+
| +++++++++ +
26
25
27
26
error[E0796]: creating a mutable reference to a 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
34
33
help: use `addr_of_mut!` instead to create a raw pointer
35
34
|
36
-
LL - let ref mut _a = X;
37
-
LL + let ref mut _a = addr_of_mut!(X);
38
-
|
35
+
LL | let ref mut _a = addr_of_mut!(X);
36
+
| +++++++++++++ +
39
37
40
38
error[E0796]: creating a shared reference to a mutable static
Copy file name to clipboardExpand all lines: tests/ui/static/reference-to-mut-static.e2021.stderr
+2-3
Original file line number
Diff line number
Diff line change
@@ -44,9 +44,8 @@ LL | let ref _a = X;
44
44
= 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
45
45
help: use `addr_of!` instead to create a raw pointer
46
46
|
47
-
LL - let ref _a = X;
48
-
LL + let ref _a = addr_of!(X);
49
-
|
47
+
LL | let ref _a = addr_of!(X);
48
+
| +++++++++ +
50
49
51
50
error: creating a shared reference to mutable static is discouraged
Copy file name to clipboardExpand all lines: tests/ui/static/reference-to-mut-static.e2024.stderr
+2-3
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,8 @@ LL | let ref _a = X;
33
33
= 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
34
34
help: use `addr_of!` instead to create a raw pointer
35
35
|
36
-
LL - let ref _a = X;
37
-
LL + let ref _a = addr_of!(X);
38
-
|
36
+
LL | let ref _a = addr_of!(X);
37
+
| +++++++++ +
39
38
40
39
error[E0796]: creating a shared reference to a mutable static
0 commit comments