|
1 | 1 | error[E0080]: it is undefined behavior to use this value
|
2 |
| - --> $DIR/union-ub-fat-ptr.rs:78:1 |
| 2 | + --> $DIR/ub-wide-ptr.rs:84:1 |
3 | 3 | |
|
4 |
| -LL | const B: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.str}; |
5 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (not entirely in bounds) |
| 4 | +LL | const STR_TOO_LONG: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.str}; |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (not entirely in bounds) |
6 | 6 | |
|
7 | 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 rust compiler repository if you believe it should not be considered undefined behavior
|
8 | 8 |
|
9 | 9 | error[E0080]: it is undefined behavior to use this value
|
10 |
| - --> $DIR/union-ub-fat-ptr.rs:81:1 |
| 10 | + --> $DIR/ub-wide-ptr.rs:87:1 |
11 | 11 | |
|
12 |
| -LL | const C: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.str}; |
13 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer |
| 12 | +LL | const STR_LENGTH_PTR: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.str}; |
| 13 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer |
14 | 14 | |
|
15 | 15 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
16 | 16 |
|
17 | 17 | error[E0080]: it is undefined behavior to use this value
|
18 |
| - --> $DIR/union-ub-fat-ptr.rs:84:1 |
| 18 | + --> $DIR/ub-wide-ptr.rs:90:1 |
19 | 19 | |
|
20 |
| -LL | const C2: &MyStr = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.my_str}; |
21 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer |
| 20 | +LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.my_str}; |
| 21 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer |
22 | 22 | |
|
23 | 23 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
24 | 24 |
|
25 | 25 | error[E0080]: it is undefined behavior to use this value
|
26 |
| - --> $DIR/union-ub-fat-ptr.rs:90:1 |
| 26 | + --> $DIR/ub-wide-ptr.rs:94:1 |
27 | 27 | |
|
28 |
| -LL | const B2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.slice}; |
29 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (not entirely in bounds) |
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 rust compiler repository if you believe it should not be considered undefined behavior |
32 |
| - |
33 |
| -error[E0080]: it is undefined behavior to use this value |
34 |
| - --> $DIR/union-ub-fat-ptr.rs:93:1 |
35 |
| - | |
36 |
| -LL | const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.slice}; |
37 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer |
| 28 | +LL | const J1: &str = unsafe { SliceTransmute { slice: &[0xFF] }.str }; |
| 29 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref> |
38 | 30 | |
|
39 | 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 rust compiler repository if you believe it should not be considered undefined behavior
|
40 | 32 |
|
41 | 33 | error[E0080]: it is undefined behavior to use this value
|
42 |
| - --> $DIR/union-ub-fat-ptr.rs:97:1 |
| 34 | + --> $DIR/ub-wide-ptr.rs:97:1 |
43 | 35 | |
|
44 |
| -LL | const D: &dyn Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; |
45 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer or too small vtable |
| 36 | +LL | const J2: &MyStr = unsafe { SliceTransmute { slice: &[0xFF] }.my_str }; |
| 37 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref>.0 |
46 | 38 | |
|
47 | 39 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
48 | 40 |
|
49 | 41 | error[E0080]: it is undefined behavior to use this value
|
50 |
| - --> $DIR/union-ub-fat-ptr.rs:100:1 |
| 42 | + --> $DIR/ub-wide-ptr.rs:104:1 |
51 | 43 | |
|
52 |
| -LL | const E: &dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; |
53 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer or too small vtable |
| 44 | +LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { SliceTransmute { addr: 42 }.slice}; |
| 45 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized data in wide pointer metadata |
54 | 46 | |
|
55 | 47 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
56 | 48 |
|
57 | 49 | error[E0080]: it is undefined behavior to use this value
|
58 |
| - --> $DIR/union-ub-fat-ptr.rs:103:1 |
| 50 | + --> $DIR/ub-wide-ptr.rs:107:1 |
59 | 51 | |
|
60 |
| -LL | const F: &dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; |
61 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer or too small vtable |
| 52 | +LL | const SLICE_TOO_LONG: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.slice}; |
| 53 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (not entirely in bounds) |
62 | 54 | |
|
63 | 55 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
64 | 56 |
|
65 | 57 | error[E0080]: it is undefined behavior to use this value
|
66 |
| - --> $DIR/union-ub-fat-ptr.rs:107:1 |
| 58 | + --> $DIR/ub-wide-ptr.rs:110:1 |
67 | 59 | |
|
68 |
| -LL | const G: &dyn Trait = &unsafe { BoolTransmute { val: 3 }.bl }; |
69 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.<dyn-downcast>, but expected something less or equal to 1 |
| 60 | +LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.slice}; |
| 61 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer |
70 | 62 | |
|
71 | 63 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
72 | 64 |
|
73 | 65 | error[E0080]: it is undefined behavior to use this value
|
74 |
| - --> $DIR/union-ub-fat-ptr.rs:111:1 |
| 66 | + --> $DIR/ub-wide-ptr.rs:114:1 |
75 | 67 | |
|
76 | 68 | LL | const H: &[bool] = &[unsafe { BoolTransmute { val: 3 }.bl }];
|
77 | 69 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>[0], but expected something less or equal to 1
|
78 | 70 | |
|
79 | 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 rust compiler repository if you believe it should not be considered undefined behavior
|
80 | 72 |
|
81 | 73 | error[E0080]: it is undefined behavior to use this value
|
82 |
| - --> $DIR/union-ub-fat-ptr.rs:117:1 |
| 74 | + --> $DIR/ub-wide-ptr.rs:120:1 |
83 | 75 | |
|
84 | 76 | LL | const I2: &MySliceBool = &MySlice(unsafe { BoolTransmute { val: 3 }.bl }, [false]);
|
85 | 77 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.0, but expected something less or equal to 1
|
86 | 78 | |
|
87 | 79 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
88 | 80 |
|
89 | 81 | error[E0080]: it is undefined behavior to use this value
|
90 |
| - --> $DIR/union-ub-fat-ptr.rs:120:1 |
| 82 | + --> $DIR/ub-wide-ptr.rs:123:1 |
91 | 83 | |
|
92 | 84 | LL | const I3: &MySliceBool = &MySlice(true, [unsafe { BoolTransmute { val: 3 }.bl }]);
|
93 | 85 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.1[0], but expected something less or equal to 1
|
94 | 86 | |
|
95 | 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 rust compiler repository if you believe it should not be considered undefined behavior
|
96 | 88 |
|
97 | 89 | error[E0080]: it is undefined behavior to use this value
|
98 |
| - --> $DIR/union-ub-fat-ptr.rs:124:1 |
| 90 | + --> $DIR/ub-wide-ptr.rs:130:1 |
99 | 91 | |
|
100 |
| -LL | const J1: &str = unsafe { SliceTransmute { slice: &[0xFF] }.str }; |
101 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref> |
| 92 | +LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { SliceTransmute { addr: 42 }.raw_slice}; |
| 93 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized data in wide pointer metadata |
102 | 94 | |
|
103 | 95 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
104 | 96 |
|
105 | 97 | error[E0080]: it is undefined behavior to use this value
|
106 |
| - --> $DIR/union-ub-fat-ptr.rs:127:1 |
| 98 | + --> $DIR/ub-wide-ptr.rs:135:1 |
107 | 99 | |
|
108 |
| -LL | const J2: &MyStr = unsafe { SliceTransmute { slice: &[0xFF] }.my_str }; |
109 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref>.0 |
| 100 | +LL | const D: &dyn Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; |
| 101 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable |
| 102 | + | |
| 103 | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior |
| 104 | + |
| 105 | +error[E0080]: it is undefined behavior to use this value |
| 106 | + --> $DIR/ub-wide-ptr.rs:138:1 |
| 107 | + | |
| 108 | +LL | const E: &dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; |
| 109 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable |
| 110 | + | |
| 111 | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior |
| 112 | + |
| 113 | +error[E0080]: it is undefined behavior to use this value |
| 114 | + --> $DIR/ub-wide-ptr.rs:141:1 |
| 115 | + | |
| 116 | +LL | const F: &dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; |
| 117 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable |
| 118 | + | |
| 119 | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior |
| 120 | + |
| 121 | +error[E0080]: it is undefined behavior to use this value |
| 122 | + --> $DIR/ub-wide-ptr.rs:145:1 |
| 123 | + | |
| 124 | +LL | const G: &dyn Trait = &unsafe { BoolTransmute { val: 3 }.bl }; |
| 125 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.<dyn-downcast>, but expected something less or equal to 1 |
| 126 | + | |
| 127 | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior |
| 128 | + |
| 129 | +error[E0080]: it is undefined behavior to use this value |
| 130 | + --> $DIR/ub-wide-ptr.rs:149:1 |
| 131 | + | |
| 132 | +LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 0 } }.rust}; |
| 133 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable |
| 134 | + | |
| 135 | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior |
| 136 | + |
| 137 | +error[E0080]: it is undefined behavior to use this value |
| 138 | + --> $DIR/ub-wide-ptr.rs:151:1 |
| 139 | + | |
| 140 | +LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.raw_rust}; |
| 141 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable |
110 | 142 | |
|
111 | 143 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
|
112 | 144 |
|
113 |
| -error: aborting due to 14 previous errors |
| 145 | +error: aborting due to 18 previous errors |
114 | 146 |
|
115 | 147 | For more information about this error, try `rustc --explain E0080`.
|
0 commit comments