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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
29
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
30
30
|
31
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
32
= note: the raw bytes of the constant (size: 4, align: 4) {
@@ -37,7 +37,7 @@ error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
40
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean
41
41
|
42
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
43
= note: the raw bytes of the constant (size: 1, align: 1) {
@@ -48,7 +48,7 @@ error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
51
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean
52
52
|
53
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
54
= note: the raw bytes of the constant (size: 1, align: 1) {
@@ -59,7 +59,7 @@ 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`)
62
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
63
63
|
64
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
65
= note: the raw bytes of the constant (size: 4, align: 4) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
29
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
30
30
|
31
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
32
= note: the raw bytes of the constant (size: 4, align: 4) {
@@ -37,7 +37,7 @@ error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
40
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean
41
41
|
42
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
43
= note: the raw bytes of the constant (size: 1, align: 1) {
@@ -48,7 +48,7 @@ error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean
51
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean
52
52
|
53
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
54
= note: the raw bytes of the constant (size: 1, align: 1) {
@@ -59,7 +59,7 @@ 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`)
62
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
63
63
|
64
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
65
= note: the raw bytes of the constant (size: 4, align: 4) {
Copy file name to clipboardExpand all lines: src/test/ui/const-ptr/forbidden_slices.32bit.stderr
+8-8
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ error[E0080]: it is undefined behavior to use this value
44
44
--> $DIR/forbidden_slices.rs:26:1
45
45
|
46
46
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
47
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered uninitialized bytes
47
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
48
48
|
49
49
= 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.
50
50
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -55,7 +55,7 @@ error[E0080]: it is undefined behavior to use this value
55
55
--> $DIR/forbidden_slices.rs:28:1
56
56
|
57
57
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
58
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
58
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
59
59
|
60
60
= 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.
61
61
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -66,7 +66,7 @@ error[E0080]: it is undefined behavior to use this value
66
66
--> $DIR/forbidden_slices.rs:30:1
67
67
|
68
68
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
69
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean
69
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
70
70
|
71
71
= 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.
72
72
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -82,7 +82,7 @@ LL | | let ptr = (&D2 as *const Struct as *const u16).byte_add(1);
82
82
LL | |
83
83
LL | | from_raw_parts(ptr, 4)
84
84
LL | | };
85
-
| |__^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
85
+
| |__^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
86
86
|
87
87
= 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.
88
88
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -168,7 +168,7 @@ LL | |
168
168
LL | | let ptr = (&D1) as *const MaybeUninit<&u32> as *const u8;
169
169
LL | | from_ptr_range(ptr..ptr.add(1))
170
170
LL | | };
171
-
| |__^ type validation failed at .<deref>[0]: encountered uninitialized bytes
171
+
| |__^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
172
172
|
173
173
= 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.
174
174
= note: the raw bytes of the constant (size: 8, align: 4) {
| |__^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
186
+
| |__^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
187
187
|
188
188
= 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.
189
189
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -198,7 +198,7 @@ LL | |
198
198
LL | | let ptr = &D0 as *const u32 as *const bool;
199
199
LL | | from_ptr_range(ptr..ptr.add(4))
200
200
LL | | };
201
-
| |__^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean
201
+
| |__^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
202
202
|
203
203
= 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.
204
204
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -213,7 +213,7 @@ LL | |
213
213
LL | | let ptr = (&D2 as *const Struct as *const u16).byte_add(1);
214
214
LL | | from_ptr_range(ptr..ptr.add(4))
215
215
LL | | };
216
-
| |__^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
216
+
| |__^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
217
217
|
218
218
= 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.
219
219
= note: the raw bytes of the constant (size: 8, align: 4) {
Copy file name to clipboardExpand all lines: src/test/ui/const-ptr/forbidden_slices.64bit.stderr
+8-8
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ error[E0080]: it is undefined behavior to use this value
44
44
--> $DIR/forbidden_slices.rs:26:1
45
45
|
46
46
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
47
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered uninitialized bytes
47
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
48
48
|
49
49
= 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.
50
50
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -55,7 +55,7 @@ error[E0080]: it is undefined behavior to use this value
55
55
--> $DIR/forbidden_slices.rs:28:1
56
56
|
57
57
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
58
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
58
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
59
59
|
60
60
= 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.
61
61
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -66,7 +66,7 @@ error[E0080]: it is undefined behavior to use this value
66
66
--> $DIR/forbidden_slices.rs:30:1
67
67
|
68
68
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
69
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean
69
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
70
70
|
71
71
= 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.
72
72
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -82,7 +82,7 @@ LL | | let ptr = (&D2 as *const Struct as *const u16).byte_add(1);
82
82
LL | |
83
83
LL | | from_raw_parts(ptr, 4)
84
84
LL | | };
85
-
| |__^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
85
+
| |__^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
86
86
|
87
87
= 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.
88
88
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -168,7 +168,7 @@ LL | |
168
168
LL | | let ptr = (&D1) as *const MaybeUninit<&u32> as *const u8;
169
169
LL | | from_ptr_range(ptr..ptr.add(1))
170
170
LL | | };
171
-
| |__^ type validation failed at .<deref>[0]: encountered uninitialized bytes
171
+
| |__^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
172
172
|
173
173
= 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.
174
174
= note: the raw bytes of the constant (size: 16, align: 8) {
| |__^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
186
+
| |__^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
187
187
|
188
188
= 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.
189
189
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -198,7 +198,7 @@ LL | |
198
198
LL | | let ptr = &D0 as *const u32 as *const bool;
199
199
LL | | from_ptr_range(ptr..ptr.add(4))
200
200
LL | | };
201
-
| |__^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean
201
+
| |__^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
202
202
|
203
203
= 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.
204
204
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -213,7 +213,7 @@ LL | |
213
213
LL | | let ptr = (&D2 as *const Struct as *const u16).byte_add(1);
214
214
LL | | from_ptr_range(ptr..ptr.add(4))
215
215
LL | | };
216
-
| |__^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
216
+
| |__^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
217
217
|
218
218
= 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.
219
219
= note: the raw bytes of the constant (size: 16, align: 8) {
= 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
8
= note: the raw bytes of the constant (size: 4, align: 4) {
= 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
8
= note: the raw bytes of the constant (size: 8, align: 8) {
0 commit comments