|
1 | 1 | error[E0080]: it is undefined behavior to use this value
|
2 | 2 | --> $DIR/ub-enum.rs:24:1
|
3 | 3 | |
|
4 |
| -LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.b }; |
5 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant |
| 4 | +LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.out }; |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant |
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/ub-enum.rs:38:1 |
| 10 | + --> $DIR/ub-enum.rs:43:1 |
11 | 11 | |
|
12 |
| -LL | const BAD_ENUM2 : Enum2 = unsafe { TransmuteEnum2 { a: 0 }.b }; |
13 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected a valid enum discriminant |
| 12 | +LL | const BAD_ENUM2: Enum2 = unsafe { TransmuteEnum2 { in1: 0 }.out1 }; |
| 13 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected a valid enum discriminant |
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/ub-enum.rs:42:1 |
| 18 | + --> $DIR/ub-enum.rs:45:1 |
19 | 19 | |
|
20 |
| -LL | const BAD_ENUM3 : [Enum2; 2] = [unsafe { TransmuteEnum2 { c: () }.b }; 2]; |
21 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes |
| 20 | +LL | const BAD_ENUM3: Enum2 = unsafe { TransmuteEnum2 { in2: &0 }.out1 }; |
| 21 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant |
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/ub-enum.rs:52:1 |
| 26 | + --> $DIR/ub-enum.rs:47:1 |
27 | 27 | |
|
28 |
| -LL | const BAD_ENUM_CHAR : Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b })); |
29 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 4294967295 at .Some.0.1, but expected something in the range 0..=1114111 |
| 28 | +LL | const BAD_ENUM4: Wrap<Enum2> = unsafe { TransmuteEnum2 { in2: &0 }.out2 }; |
| 29 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected something that cannot possibly fail to be in the range 2..=2 |
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 rust compiler repository if you believe it should not be considered undefined behavior
|
32 | 32 |
|
33 |
| -error: aborting due to 4 previous errors |
| 33 | +error[E0080]: it is undefined behavior to use this value |
| 34 | + --> $DIR/ub-enum.rs:51:1 |
| 35 | + | |
| 36 | +LL | const BAD_ENUM_UNDEF: [Enum2; 2] = [unsafe { TransmuteEnum2 { in3: () }.out1 }; 2]; |
| 37 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes |
| 38 | + | |
| 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 |
| 40 | + |
| 41 | +error[E0080]: it is undefined behavior to use this value |
| 42 | + --> $DIR/ub-enum.rs:61:1 |
| 43 | + | |
| 44 | +LL | const BAD_ENUM_CHAR: Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b })); |
| 45 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 4294967295 at .Some.0.1, but expected something in the range 0..=1114111 |
| 46 | + | |
| 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 |
| 48 | + |
| 49 | +error: aborting due to 6 previous errors |
34 | 50 |
|
35 | 51 | For more information about this error, try `rustc --explain E0080`.
|
0 commit comments