about summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/ub-uninhabit.stderr
blob: aca0b13bb90700535e1fca36532985df2de02891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
error[E0080]: constructing invalid value: encountered a value of uninhabited type `Bar`
  --> $DIR/ub-uninhabit.rs:20:35
   |
LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_BAD_BAD` failed here

error[E0080]: constructing invalid value: encountered a reference pointing to uninhabited type Bar
  --> $DIR/ub-uninhabit.rs:23:1
   |
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
   | ^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value
   |
   = 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.
   = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
               HEX_DUMP
           }

error[E0080]: constructing invalid value at [0]: encountered a value of uninhabited type `Bar`
  --> $DIR/ub-uninhabit.rs:26:42
   |
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_BAD_ARRAY` failed here

error[E0080]: constructing invalid value: encountered a value of the never type `!`
  --> $DIR/ub-uninhabit.rs:32:16
   |
LL |     let _val = intrinsics::read_via_copy(ptr);
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `READ_NEVER` failed here

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0080`.