@@ -436,30 +436,20 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_,
436
436
╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──╼╾──╼
437
437
}
438
438
439
- error[E0080]: it is undefined behavior to use this value
440
- --> $DIR/raw-bytes.rs:196:1
439
+ error[E0080]: evaluation of constant value failed
440
+ --> $DIR/raw-bytes.rs:196:62
441
441
|
442
442
LL | 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: 8, align: 4) {
447
- ╾ALLOC_ID╼ 00 00 00 00 │ ╾──╼....
448
- }
443
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
449
444
450
- error[E0080]: it is undefined behavior to use this value
451
- --> $DIR/raw-bytes.rs:198:1
445
+ error[E0080]: evaluation of constant value failed
446
+ --> $DIR/raw-bytes.rs:199:65
452
447
|
453
448
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
454
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27<imm>, 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: 8, align: 4) {
458
- ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──╼╾──╼
459
- }
449
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using ALLOC32 as vtable pointer but it does not point to a vtable
460
450
461
451
error[E0080]: it is undefined behavior to use this value
462
- --> $DIR/raw-bytes.rs:202 :1
452
+ --> $DIR/raw-bytes.rs:204 :1
463
453
|
464
454
LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
465
455
| ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1]
@@ -470,7 +460,7 @@ LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
470
460
}
471
461
472
462
error[E0080]: it is undefined behavior to use this value
473
- --> $DIR/raw-bytes.rs:203 :1
463
+ --> $DIR/raw-bytes.rs:205 :1
474
464
|
475
465
LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
476
466
| ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -481,7 +471,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
481
471
}
482
472
483
473
error[E0080]: it is undefined behavior to use this value
484
- --> $DIR/raw-bytes.rs:204 :1
474
+ --> $DIR/raw-bytes.rs:206 :1
485
475
|
486
476
LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
487
477
| ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -492,7 +482,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
492
482
}
493
483
494
484
error[E0080]: it is undefined behavior to use this value
495
- --> $DIR/raw-bytes.rs:208 :1
485
+ --> $DIR/raw-bytes.rs:210 :1
496
486
|
497
487
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
498
488
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -503,7 +493,7 @@ LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }
503
493
}
504
494
505
495
error[E0080]: it is undefined behavior to use this value
506
- --> $DIR/raw-bytes.rs:211 :1
496
+ --> $DIR/raw-bytes.rs:213 :1
507
497
|
508
498
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
509
499
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -516,7 +506,7 @@ LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem:
516
506
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
517
507
518
508
error[E0080]: it is undefined behavior to use this value
519
- --> $DIR/raw-bytes.rs:214 :1
509
+ --> $DIR/raw-bytes.rs:216 :1
520
510
|
521
511
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
522
512
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
@@ -527,7 +517,7 @@ LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4)
527
517
}
528
518
529
519
error[E0080]: it is undefined behavior to use this value
530
- --> $DIR/raw-bytes.rs:218 :1
520
+ --> $DIR/raw-bytes.rs:220 :1
531
521
|
532
522
LL | pub static S7: &[u16] = unsafe {
533
523
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
@@ -538,7 +528,7 @@ LL | pub static S7: &[u16] = unsafe {
538
528
}
539
529
540
530
error[E0080]: it is undefined behavior to use this value
541
- --> $DIR/raw-bytes.rs:225 :1
531
+ --> $DIR/raw-bytes.rs:227 :1
542
532
|
543
533
LL | pub static R4: &[u8] = unsafe {
544
534
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -549,7 +539,7 @@ LL | pub static R4: &[u8] = unsafe {
549
539
}
550
540
551
541
error[E0080]: it is undefined behavior to use this value
552
- --> $DIR/raw-bytes.rs:230 :1
542
+ --> $DIR/raw-bytes.rs:232 :1
553
543
|
554
544
LL | pub static R5: &[u8] = unsafe {
555
545
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -562,7 +552,7 @@ LL | pub static R5: &[u8] = unsafe {
562
552
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
563
553
564
554
error[E0080]: it is undefined behavior to use this value
565
- --> $DIR/raw-bytes.rs:235 :1
555
+ --> $DIR/raw-bytes.rs:237 :1
566
556
|
567
557
LL | pub static R6: &[bool] = unsafe {
568
558
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
0 commit comments