|
| 1 | +error[E0080]: it is undefined behavior to use this value |
| 2 | + --> $DIR/validity.rs:8:1 |
| 3 | + | |
| 4 | +LL | const BAD: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 |
| 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: 4, align: 4) { |
| 9 | + 00 00 00 00 │ .... |
| 10 | + } |
| 11 | + |
| 12 | +error[E0080]: evaluation of constant value failed |
| 13 | + --> $DIR/validity.rs:11:1 |
| 14 | + | |
| 15 | +LL | const BAD_PTR: pattern_type!(usize is 1..) = unsafe { std::mem::transmute(&42) }; |
| 16 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer |
| 17 | + | |
| 18 | + = help: this code performed an operation that depends on the underlying bytes representing a pointer |
| 19 | + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported |
| 20 | + |
| 21 | +error[E0080]: it is undefined behavior to use this value |
| 22 | + --> $DIR/validity.rs:14:1 |
| 23 | + | |
| 24 | +LL | const BAD_AGGREGATE: (pattern_type!(u32 is 1..), u32) = (unsafe { std::mem::transmute(0) }, 0); |
| 25 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 |
| 26 | + | |
| 27 | + = 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. |
| 28 | + = note: the raw bytes of the constant (size: 8, align: 4) { |
| 29 | + 00 00 00 00 00 00 00 00 │ ........ |
| 30 | + } |
| 31 | + |
| 32 | +error[E0080]: it is undefined behavior to use this value |
| 33 | + --> $DIR/validity.rs:20:1 |
| 34 | + | |
| 35 | +LL | const BAD_FOO: Foo = Foo(Bar(unsafe { std::mem::transmute(0) })); |
| 36 | + | ^^^^^^^^^^^^^^^^^^ constructing invalid value at .0.0: encountered 0, but expected something greater or equal to 1 |
| 37 | + | |
| 38 | + = 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. |
| 39 | + = note: the raw bytes of the constant (size: 4, align: 4) { |
| 40 | + 00 00 00 00 │ .... |
| 41 | + } |
| 42 | + |
| 43 | +error: aborting due to 4 previous errors |
| 44 | + |
| 45 | +For more information about this error, try `rustc --explain E0080`. |
0 commit comments