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
Instead of only validating values which actually get stored to a const,
this PR attempts to turn on full validation in the presence of unsafe
code, as detected by walking HIR when available.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
30
-
|
31
-
= 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.
32
-
= note: the raw bytes of the constant (size: 4, align: 4) {
33
-
__ __ __ __ │ ░░░░
34
-
}
29
+
| ^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
35
30
36
-
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
41
-
|
42
-
= 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.
43
-
= note: the raw bytes of the constant (size: 1, align: 1) {
44
-
42 │ B
45
-
}
35
+
| ^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
46
36
47
-
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
52
-
|
53
-
= 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.
54
-
= note: the raw bytes of the constant (size: 1, align: 1) {
55
-
42 │ B
56
-
}
41
+
| ^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
57
42
58
-
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
63
-
|
64
-
= 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.
65
-
= note: the raw bytes of the constant (size: 4, align: 4) {
66
-
__ __ __ __ │ ░░░░
67
-
}
47
+
| ^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
30
-
|
31
-
= 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.
32
-
= note: the raw bytes of the constant (size: 4, align: 4) {
33
-
__ __ __ __ │ ░░░░
34
-
}
29
+
| ^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
35
30
36
-
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
41
-
|
42
-
= 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.
43
-
= note: the raw bytes of the constant (size: 1, align: 1) {
44
-
42 │ B
45
-
}
35
+
| ^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
46
36
47
-
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
52
-
|
53
-
= 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.
54
-
= note: the raw bytes of the constant (size: 1, align: 1) {
55
-
42 │ B
56
-
}
41
+
| ^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
57
42
58
-
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
63
-
|
64
-
= 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.
65
-
= note: the raw bytes of the constant (size: 4, align: 4) {
66
-
__ __ __ __ │ ░░░░
67
-
}
47
+
| ^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
Copy file name to clipboardExpand all lines: src/test/ui/consts/const-err4.32bit.stderr
+3-8
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,8 @@
1
-
error[E0080]: it is undefined behavior to use this value
2
-
--> $DIR/const-err4.rs:9:11
1
+
error[E0080]: evaluation of constant value failed
2
+
--> $DIR/const-err4.rs:9:21
3
3
|
4
4
LL | Boo = [unsafe { Foo { b: () }.a }; 4][3],
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes
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
-
__ __ __ __ │ ░░░░
10
-
}
5
+
| ^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes
0 commit comments