|
| 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_UNINIT: pattern_type!(u32 is 1..) = |
| 16 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory |
| 17 | + |
| 18 | +error[E0080]: evaluation of constant value failed |
| 19 | + --> $DIR/validity.rs:15:1 |
| 20 | + | |
| 21 | +LL | const BAD_PTR: pattern_type!(usize is 1..) = unsafe { std::mem::transmute(&42) }; |
| 22 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer |
| 23 | + | |
| 24 | + = help: this code performed an operation that depends on the underlying bytes representing a pointer |
| 25 | + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported |
| 26 | + |
| 27 | +error[E0080]: it is undefined behavior to use this value |
| 28 | + --> $DIR/validity.rs:18:1 |
| 29 | + | |
| 30 | +LL | const BAD_AGGREGATE: (pattern_type!(u32 is 1..), u32) = (unsafe { std::mem::transmute(0) }, 0); |
| 31 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 |
| 32 | + | |
| 33 | + = 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. |
| 34 | + = note: the raw bytes of the constant (size: 8, align: 4) { |
| 35 | + 00 00 00 00 00 00 00 00 │ ........ |
| 36 | + } |
| 37 | + |
| 38 | +error[E0080]: it is undefined behavior to use this value |
| 39 | + --> $DIR/validity.rs:24:1 |
| 40 | + | |
| 41 | +LL | const BAD_FOO: Foo = Foo(Bar(unsafe { std::mem::transmute(0) })); |
| 42 | + | ^^^^^^^^^^^^^^^^^^ constructing invalid value at .0.0: encountered 0, but expected something greater or equal to 1 |
| 43 | + | |
| 44 | + = 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. |
| 45 | + = note: the raw bytes of the constant (size: 4, align: 4) { |
| 46 | + 00 00 00 00 │ .... |
| 47 | + } |
| 48 | + |
| 49 | +error[E0080]: evaluation of constant value failed |
| 50 | + --> $DIR/validity.rs:27:1 |
| 51 | + | |
| 52 | +LL | const CHAR_UNINIT: pattern_type!(char is 'A'..'Z') = |
| 53 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory |
| 54 | + |
| 55 | +error[E0080]: it is undefined behavior to use this value |
| 56 | + --> $DIR/validity.rs:31:1 |
| 57 | + | |
| 58 | +LL | const CHAR_OOB_PAT: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute('a') }; |
| 59 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 97, but expected something in the range 65..=89 |
| 60 | + | |
| 61 | + = 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. |
| 62 | + = note: the raw bytes of the constant (size: 4, align: 4) { |
| 63 | + 61 00 00 00 │ a... |
| 64 | + } |
| 65 | + |
| 66 | +error[E0080]: it is undefined behavior to use this value |
| 67 | + --> $DIR/validity.rs:34:1 |
| 68 | + | |
| 69 | +LL | const CHAR_OOB: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute(u32::MAX) }; |
| 70 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) |
| 71 | + | |
| 72 | + = 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. |
| 73 | + = note: the raw bytes of the constant (size: 4, align: 4) { |
| 74 | + ff ff ff ff │ .... |
| 75 | + } |
| 76 | + |
| 77 | +error: aborting due to 8 previous errors |
| 78 | + |
| 79 | +For more information about this error, try `rustc --explain E0080`. |
0 commit comments