]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/ub-enum.stderr
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / ub-enum.stderr
CommitLineData
a1dfa0c6 1error[E0080]: it is undefined behavior to use this value
f9f354fc 2 --> $DIR/ub-enum.rs:24:1
8faf50e0 3 |
74b04a01 4LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
f035d41b 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x00000001 at .<enum-tag>, but expected a valid enum tag
8faf50e0 6 |
e1599b0c 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.
8faf50e0 8
a1dfa0c6 9error[E0080]: it is undefined behavior to use this value
f9f354fc 10 --> $DIR/ub-enum.rs:27:1
416331ca 11 |
74b04a01 12LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
f9f354fc 13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc8 at .<enum-tag>, but expected initialized plain (non-pointer) bytes
416331ca 14 |
e1599b0c 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 rustc repository if you believe it should not be considered undefined behavior.
416331ca
XL
16
17error[E0080]: it is undefined behavior to use this value
f9f354fc 18 --> $DIR/ub-enum.rs:30:1
416331ca 19 |
74b04a01 20LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
1b1a35ee 21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc12 at .0.<enum-tag>, but expected initialized plain (non-pointer) bytes
416331ca 22 |
e1599b0c 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 rustc repository if you believe it should not be considered undefined behavior.
416331ca
XL
24
25error[E0080]: it is undefined behavior to use this value
f9f354fc 26 --> $DIR/ub-enum.rs:42:1
8faf50e0 27 |
74b04a01 28LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
f035d41b 29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x00000000 at .<enum-tag>, but expected a valid enum tag
8faf50e0 30 |
e1599b0c 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 rustc repository if you believe it should not be considered undefined behavior.
8faf50e0 32
a1dfa0c6 33error[E0080]: it is undefined behavior to use this value
f9f354fc 34 --> $DIR/ub-enum.rs:44:1
8faf50e0 35 |
74b04a01 36LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
1b1a35ee 37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc18 at .<enum-tag>, but expected initialized plain (non-pointer) bytes
8faf50e0 38 |
e1599b0c 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 rustc repository if you believe it should not be considered undefined behavior.
8faf50e0 40
a1dfa0c6 41error[E0080]: it is undefined behavior to use this value
f9f354fc 42 --> $DIR/ub-enum.rs:47:1
a1dfa0c6 43 |
74b04a01 44LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
1b1a35ee 45 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc22 at .0.<enum-tag>, but expected initialized plain (non-pointer) bytes
a1dfa0c6 46 |
e1599b0c 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 rustc repository if you believe it should not be considered undefined behavior.
a1dfa0c6
XL
48
49error[E0080]: it is undefined behavior to use this value
f9f354fc 50 --> $DIR/ub-enum.rs:56:1
a1dfa0c6 51 |
74b04a01
XL
52LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
53 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes at .<enum-tag>, but expected initialized plain (non-pointer) bytes
a1dfa0c6 54 |
e1599b0c 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 rustc repository if you believe it should not be considered undefined behavior.
a1dfa0c6
XL
56
57error[E0080]: it is undefined behavior to use this value
f9f354fc 58 --> $DIR/ub-enum.rs:60:1
a1dfa0c6 59 |
74b04a01 60LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
1b1a35ee 61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc28 at .<enum-tag>, but expected initialized plain (non-pointer) bytes
a1dfa0c6 62 |
e1599b0c 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 rustc repository if you believe it should not be considered undefined behavior.
a1dfa0c6
XL
64
65error[E0080]: it is undefined behavior to use this value
f9f354fc 66 --> $DIR/ub-enum.rs:77:1
a1dfa0c6 67 |
74b04a01
XL
68LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
69 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of the never type `!` at .<enum-variant(B)>.0
a1dfa0c6 70 |
e1599b0c 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 rustc repository if you believe it should not be considered undefined behavior.
a1dfa0c6 72
74b04a01 73error[E0080]: it is undefined behavior to use this value
f9f354fc 74 --> $DIR/ub-enum.rs:79:1
74b04a01
XL
75 |
76LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
77 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Never at .<enum-variant(D)>.0
78 |
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 rustc repository if you believe it should not be considered undefined behavior.
80
81error[E0080]: it is undefined behavior to use this value
f9f354fc 82 --> $DIR/ub-enum.rs:87:1
74b04a01
XL
83 |
84LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
f9f354fc 85 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0xffffffff at .<enum-variant(Some)>.0.1, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
74b04a01
XL
86 |
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 rustc repository if you believe it should not be considered undefined behavior.
88
89error[E0080]: it is undefined behavior to use this value
f035d41b 90 --> $DIR/ub-enum.rs:92:1
74b04a01 91 |
f035d41b
XL
92LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
93 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Never at .<enum-variant(Ok)>.0.1
74b04a01
XL
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
97error[E0080]: it is undefined behavior to use this value
f035d41b 98 --> $DIR/ub-enum.rs:94:1
74b04a01 99 |
f035d41b
XL
100LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of the never type `!` at .<enum-variant(Ok)>.0.1
74b04a01
XL
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 rustc repository if you believe it should not be considered undefined behavior.
104
105error: aborting due to 13 previous errors
8faf50e0
XL
106
107For more information about this error, try `rustc --explain E0080`.