fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0080]: it is undefined behavior to use this value 2 --> $DIR/raw-bytes.rs:20:1 3 | 4LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) }; 5 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag 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: 8, align: 8) { 9 01 00 00 00 00 00 00 00 │ ........ 10 } 11 12error[E0080]: it is undefined behavior to use this value 13 --> $DIR/raw-bytes.rs:28:1 14 | 15LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; 16 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag 17 | 18 = 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. 19 = note: the raw bytes of the constant (size: 8, align: 8) { 20 00 00 00 00 00 00 00 00 │ ........ 21 } 22 23error[E0080]: it is undefined behavior to use this value 24 --> $DIR/raw-bytes.rs:42:1 25 | 26LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) }; 27 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant 28 | 29 = 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. 30 = note: the raw bytes of the constant (size: 1, align: 1) { 31 01 │ . 32 } 33 34error[E0080]: it is undefined behavior to use this value 35 --> $DIR/raw-bytes.rs:44:1 36 | 37LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) }; 38 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant 39 | 40 = 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. 41 = note: the raw bytes of the constant (size: 1, align: 1) { 42 03 │ . 43 } 44 45error[E0080]: it is undefined behavior to use this value 46 --> $DIR/raw-bytes.rs:50:1 47 | 48LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) })); 49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) 50 | 51 = 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. 52 = note: the raw bytes of the constant (size: 8, align: 4) { 53 78 00 00 00 ff ff ff ff │ x....... 54 } 55 56error[E0080]: it is undefined behavior to use this value 57 --> $DIR/raw-bytes.rs:54:1 58 | 59LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) }; 60 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 61 | 62 = 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. 63 = note: the raw bytes of the constant (size: 8, align: 8) { 64 00 00 00 00 00 00 00 00 │ ........ 65 } 66 67error[E0080]: it is undefined behavior to use this value 68 --> $DIR/raw-bytes.rs:57:1 69 | 70LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; 71 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 72 | 73 = 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. 74 = note: the raw bytes of the constant (size: 1, align: 1) { 75 00 │ . 76 } 77 78error[E0080]: it is undefined behavior to use this value 79 --> $DIR/raw-bytes.rs:59:1 80 | 81LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; 82 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 83 | 84 = 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. 85 = note: the raw bytes of the constant (size: 8, align: 8) { 86 00 00 00 00 00 00 00 00 │ ........ 87 } 88 89error[E0080]: it is undefined behavior to use this value 90 --> $DIR/raw-bytes.rs:65:1 91 | 92LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; 93 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30 94 | 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 rustc repository if you believe it should not be considered undefined behavior. 96 = note: the raw bytes of the constant (size: 4, align: 4) { 97 2a 00 00 00 │ *... 98 } 99 100error[E0080]: it is undefined behavior to use this value 101 --> $DIR/raw-bytes.rs:71:1 102 | 103LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; 104 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 105 | 106 = 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. 107 = note: the raw bytes of the constant (size: 4, align: 4) { 108 14 00 00 00 │ .... 109 } 110 111error[E0080]: it is undefined behavior to use this value 112 --> $DIR/raw-bytes.rs:74:1 113 | 114LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe { 115 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 116 | 117 = 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. 118 = note: the raw bytes of the constant (size: 16, align: 8) { 119 00 00 00 00 00 00 00 00 ╾ALLOC_ID╼ │ ........╾──────╼ 120 } 121 122error[E0080]: it is undefined behavior to use this value 123 --> $DIR/raw-bytes.rs:82:1 124 | 125LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; 126 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) 127 | 128 = 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. 129 = note: the raw bytes of the constant (size: 8, align: 8) { 130 ╾ALLOC_ID╼ │ ╾──────╼ 131 } 132 133error[E0080]: it is undefined behavior to use this value 134 --> $DIR/raw-bytes.rs:86:1 135 | 136LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) }; 137 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) 138 | 139 = 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. 140 = note: the raw bytes of the constant (size: 8, align: 8) { 141 ╾ALLOC_ID╼ │ ╾──────╼ 142 } 143 144error[E0080]: it is undefined behavior to use this value 145 --> $DIR/raw-bytes.rs:90:1 146 | 147LL | const NULL: &u16 = unsafe { mem::transmute(0usize) }; 148 | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference 149 | 150 = 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. 151 = note: the raw bytes of the constant (size: 8, align: 8) { 152 00 00 00 00 00 00 00 00 │ ........ 153 } 154 155error[E0080]: it is undefined behavior to use this value 156 --> $DIR/raw-bytes.rs:93:1 157 | 158LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) }; 159 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box 160 | 161 = 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. 162 = note: the raw bytes of the constant (size: 8, align: 8) { 163 00 00 00 00 00 00 00 00 │ ........ 164 } 165 166error[E0080]: it is undefined behavior to use this value 167 --> $DIR/raw-bytes.rs:96:1 168 | 169LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; 170 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] has no provenance) 171 | 172 = 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. 173 = note: the raw bytes of the constant (size: 8, align: 8) { 174 39 05 00 00 00 00 00 00 │ 9....... 175 } 176 177error[E0080]: it is undefined behavior to use this value 178 --> $DIR/raw-bytes.rs:99:1 179 | 180LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) }; 181 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] has no provenance) 182 | 183 = 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. 184 = note: the raw bytes of the constant (size: 8, align: 8) { 185 39 05 00 00 00 00 00 00 │ 9....... 186 } 187 188error[E0080]: it is undefined behavior to use this value 189 --> $DIR/raw-bytes.rs:102:1 190 | 191LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; 192 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer 193 | 194 = 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. 195 = note: the raw bytes of the constant (size: 8, align: 8) { 196 00 00 00 00 00 00 00 00 │ ........ 197 } 198 199error[E0080]: it is undefined behavior to use this value 200 --> $DIR/raw-bytes.rs:104:1 201 | 202LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; 203 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer 204 | 205 = 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. 206 = note: the raw bytes of the constant (size: 8, align: 8) { 207 0d 00 00 00 00 00 00 00 │ ........ 208 } 209 210error[E0080]: it is undefined behavior to use this value 211 --> $DIR/raw-bytes.rs:106:1 212 | 213LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; 214 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a function pointer 215 | 216 = 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. 217 = note: the raw bytes of the constant (size: 8, align: 8) { 218 ╾ALLOC_ID╼ │ ╾──────╼ 219 } 220 221error[E0080]: it is undefined behavior to use this value 222 --> $DIR/raw-bytes.rs:112:1 223 | 224LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; 225 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar 226 | 227 = 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. 228 = note: the raw bytes of the constant (size: 8, align: 8) { 229 01 00 00 00 00 00 00 00 │ ........ 230 } 231 232error[E0080]: it is undefined behavior to use this value 233 --> $DIR/raw-bytes.rs:137:1 234 | 235LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; 236 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) 237 | 238 = 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. 239 = note: the raw bytes of the constant (size: 16, align: 8) { 240 ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........ 241 } 242 243error[E0080]: it is undefined behavior to use this value 244 --> $DIR/raw-bytes.rs:139:1 245 | 246LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },); 247 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object 248 | 249 = 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. 250 = note: the raw bytes of the constant (size: 16, align: 8) { 251 ╾ALLOC_ID╼ ff ff ff ff ff ff ff ff │ ╾──────╼........ 252 } 253 254error[E0080]: it is undefined behavior to use this value 255 --> $DIR/raw-bytes.rs:141:1 256 | 257LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) }; 258 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object 259 | 260 = 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. 261 = note: the raw bytes of the constant (size: 16, align: 8) { 262 ╾ALLOC_ID╼ ff ff ff ff ff ff ff ff │ ╾──────╼........ 263 } 264 265error[E0080]: it is undefined behavior to use this value 266 --> $DIR/raw-bytes.rs:144:1 267 | 268LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) }; 269 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string 270 | 271 = 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. 272 = note: the raw bytes of the constant (size: 16, align: 8) { 273 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........ 274 } 275 276error[E0080]: it is undefined behavior to use this value 277 --> $DIR/raw-bytes.rs:146:1 278 | 279LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) }; 280 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string 281 | 282 = 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. 283 = note: the raw bytes of the constant (size: 16, align: 8) { 284 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........ 285 } 286 287error[E0080]: it is undefined behavior to use this value 288 --> $DIR/raw-bytes.rs:148:1 289 | 290LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) }; 291 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer, but expected a string 292 | 293 = 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. 294 = note: the raw bytes of the constant (size: 16, align: 8) { 295 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........ 296 } 297 = help: this code performed an operation that depends on the underlying bytes representing a pointer 298 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported 299 300error[E0080]: it is undefined behavior to use this value 301 --> $DIR/raw-bytes.rs:152:1 302 | 303LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; 304 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) 305 | 306 = 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. 307 = note: the raw bytes of the constant (size: 16, align: 8) { 308 ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........ 309 } 310 311error[E0080]: it is undefined behavior to use this value 312 --> $DIR/raw-bytes.rs:154:1 313 | 314LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; 315 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object 316 | 317 = 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. 318 = note: the raw bytes of the constant (size: 16, align: 8) { 319 ╾ALLOC_ID╼ ff ff ff ff ff ff ff 7f │ ╾──────╼........ 320 } 321 322error[E0080]: it is undefined behavior to use this value 323 --> $DIR/raw-bytes.rs:157:1 324 | 325LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; 326 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation) 327 | 328 = 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. 329 = note: the raw bytes of the constant (size: 16, align: 8) { 330 ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........ 331 } 332 333error[E0080]: it is undefined behavior to use this value 334 --> $DIR/raw-bytes.rs:160:1 335 | 336LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; 337 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean 338 | 339 = 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. 340 = note: the raw bytes of the constant (size: 8, align: 8) { 341 ╾ALLOC_ID╼ │ ╾──────╼ 342 } 343 344note: erroneous constant encountered 345 --> $DIR/raw-bytes.rs:160:40 346 | 347LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; 348 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 349 350error[E0080]: it is undefined behavior to use this value 351 --> $DIR/raw-bytes.rs:166:1 352 | 353LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); 354 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean 355 | 356 = 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. 357 = note: the raw bytes of the constant (size: 8, align: 8) { 358 ╾ALLOC_ID╼ │ ╾──────╼ 359 } 360 361note: erroneous constant encountered 362 --> $DIR/raw-bytes.rs:166:42 363 | 364LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); 365 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 366 367error[E0080]: it is undefined behavior to use this value 368 --> $DIR/raw-bytes.rs:170:1 369 | 370LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); 371 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean 372 | 373 = 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. 374 = note: the raw bytes of the constant (size: 8, align: 8) { 375 ╾ALLOC_ID╼ │ ╾──────╼ 376 } 377 378note: erroneous constant encountered 379 --> $DIR/raw-bytes.rs:170:42 380 | 381LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); 382 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 383 384error[E0080]: it is undefined behavior to use this value 385 --> $DIR/raw-bytes.rs:175:1 386 | 387LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; 388 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer 389 | 390 = 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. 391 = note: the raw bytes of the constant (size: 16, align: 8) { 392 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼ 393 } 394 395error[E0080]: it is undefined behavior to use this value 396 --> $DIR/raw-bytes.rs:179:1 397 | 398LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; 399 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer 400 | 401 = 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. 402 = note: the raw bytes of the constant (size: 16, align: 8) { 403 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼ 404 } 405 406error[E0080]: it is undefined behavior to use this value 407 --> $DIR/raw-bytes.rs:183:1 408 | 409LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; 410 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer 411 | 412 = 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. 413 = note: the raw bytes of the constant (size: 16, align: 8) { 414 ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........ 415 } 416 417error[E0080]: it is undefined behavior to use this value 418 --> $DIR/raw-bytes.rs:186:1 419 | 420LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; 421 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer 422 | 423 = 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. 424 = note: the raw bytes of the constant (size: 16, align: 8) { 425 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼ 426 } 427 428error[E0080]: it is undefined behavior to use this value 429 --> $DIR/raw-bytes.rs:190:1 430 | 431LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; 432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean 433 | 434 = 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. 435 = note: the raw bytes of the constant (size: 16, align: 8) { 436 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼ 437 } 438 439error[E0080]: it is undefined behavior to use this value 440 --> $DIR/raw-bytes.rs:194:1 441 | 442LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; 443 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer 444 | 445 = 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. 446 = note: the raw bytes of the constant (size: 16, align: 8) { 447 ╾ALLOC_ID╼ 00 00 00 00 00 00 00 00 │ ╾──────╼........ 448 } 449 450error[E0080]: it is undefined behavior to use this value 451 --> $DIR/raw-bytes.rs:196:1 452 | 453LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; 454 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer 455 | 456 = 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. 457 = note: the raw bytes of the constant (size: 16, align: 8) { 458 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼ 459 } 460 461error[E0080]: it is undefined behavior to use this value 462 --> $DIR/raw-bytes.rs:201:1 463 | 464LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; 465 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag 466 | 467 = 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. 468 = note: the raw bytes of the constant (size: 16, align: 8) { 469 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 │ ................ 470 } 471 472error[E0080]: it is undefined behavior to use this value 473 --> $DIR/raw-bytes.rs:205:1 474 | 475LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) }; 476 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag 477 | 478 = 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. 479 = note: the raw bytes of the constant (size: 16, align: 8) { 480 03 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00 │ ................ 481 } 482 483error[E0080]: it is undefined behavior to use this value 484 --> $DIR/raw-bytes.rs:209:1 485 | 486LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; 487 | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1] 488 | 489 = 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. 490 = note: the raw bytes of the constant (size: 8, align: 8) { 491 01 00 00 00 00 00 00 00 │ ........ 492 } 493 494error[E0080]: it is undefined behavior to use this value 495 --> $DIR/raw-bytes.rs:210:1 496 | 497LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; 498 | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!` 499 | 500 = 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. 501 = note: the raw bytes of the constant (size: 16, align: 8) { 502 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................ 503 } 504 505error[E0080]: it is undefined behavior to use this value 506 --> $DIR/raw-bytes.rs:211:1 507 | 508LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; 509 | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!` 510 | 511 = 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. 512 = note: the raw bytes of the constant (size: 16, align: 8) { 513 01 00 00 00 00 00 00 00 2a 00 00 00 00 00 00 00 │ ........*....... 514 } 515 516error[E0080]: it is undefined behavior to use this value 517 --> $DIR/raw-bytes.rs:215:1 518 | 519LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }; 520 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer 521 | 522 = 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. 523 = note: the raw bytes of the constant (size: 16, align: 8) { 524 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........ 525 } 526 527error[E0080]: it is undefined behavior to use this value 528 --> $DIR/raw-bytes.rs:218:1 529 | 530LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) }; 531 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer 532 | 533 = 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. 534 = note: the raw bytes of the constant (size: 16, align: 8) { 535 ╾ALLOC_ID╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........ 536 } 537 = help: this code performed an operation that depends on the underlying bytes representing a pointer 538 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported 539 540error[E0080]: it is undefined behavior to use this value 541 --> $DIR/raw-bytes.rs:221:1 542 | 543LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) }; 544 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean 545 | 546 = 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. 547 = note: the raw bytes of the constant (size: 16, align: 8) { 548 ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........ 549 } 550 551error[E0080]: it is undefined behavior to use this value 552 --> $DIR/raw-bytes.rs:225:1 553 | 554LL | pub static S7: &[u16] = unsafe { 555 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer 556 | 557 = 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. 558 = note: the raw bytes of the constant (size: 16, align: 8) { 559 ╾ALLOC_ID+0x2╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........ 560 } 561 562error[E0080]: it is undefined behavior to use this value 563 --> $DIR/raw-bytes.rs:232:1 564 | 565LL | pub static R4: &[u8] = unsafe { 566 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer 567 | 568 = 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. 569 = note: the raw bytes of the constant (size: 16, align: 8) { 570 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........ 571 } 572 573error[E0080]: it is undefined behavior to use this value 574 --> $DIR/raw-bytes.rs:237:1 575 | 576LL | pub static R5: &[u8] = unsafe { 577 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer 578 | 579 = 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. 580 = note: the raw bytes of the constant (size: 16, align: 8) { 581 ╾ALLOC_ID╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........ 582 } 583 = help: this code performed an operation that depends on the underlying bytes representing a pointer 584 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported 585 586error[E0080]: it is undefined behavior to use this value 587 --> $DIR/raw-bytes.rs:242:1 588 | 589LL | pub static R6: &[bool] = unsafe { 590 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean 591 | 592 = 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. 593 = note: the raw bytes of the constant (size: 16, align: 8) { 594 ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........ 595 } 596 597error: aborting due to 52 previous errors 598 599For more information about this error, try `rustc --explain E0080`.