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/consts/const_refs_to_static_fail.stderr
+14-3
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,19 @@
1
-
error[E0080]: evaluation of constant value failed
2
-
--> $DIR/const_refs_to_static_fail.rs:9:13
1
+
error[E0080]: it is undefined behavior to use this value
2
+
--> $DIR/const_refs_to_static_fail.rs:7:1
3
+
|
4
+
LL | const C1: &SyncUnsafeCell<i32> = &S;
5
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
6
+
|
7
+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
8
+
= note: the raw bytes of the constant (size: 4, align: 4) {
9
+
╾ALLOC0╼ │ ╾──╼
10
+
}
11
+
12
+
note: erroneous constant encountered
13
+
--> $DIR/const_refs_to_static_fail.rs:10:14
3
14
|
4
15
LL | assert!(*C1.get() == 0);
5
-
| ^^^^^^^^^ constant accesses mutable global memory
0 commit comments