|
1 |
| -error[E0308]: mismatched types |
2 |
| - --> $DIR/int_ptr_for_zst_slices.rs:1:28 |
| 1 | +error[E0080]: it is undefined behavior to use this value |
| 2 | + --> $DIR/int_ptr_for_zst_slices.rs:3:1 |
3 | 3 | |
|
4 |
| -LL | const FOO: &str = unsafe { &*(1_usize as *const [u8; 0] as *const [u8] as *const [str]) }; |
5 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found slice |
| 4 | +LL | const FOO: &str = unsafe { &*(1_usize as *const [u8; 0] as *const [u8] as *const str) }; |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref> |
6 | 6 | |
|
7 |
| - = note: expected type `&'static str` |
8 |
| - found type `&[str]` |
| 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 |
9 | 8 |
|
10 |
| -error[E0277]: the size for values of type `str` cannot be known at compilation time |
11 |
| - --> $DIR/int_ptr_for_zst_slices.rs:1:75 |
12 |
| - | |
13 |
| -LL | const FOO: &str = unsafe { &*(1_usize as *const [u8; 0] as *const [u8] as *const [str]) }; |
14 |
| - | ^^^^^^^^^^^^ doesn't have a size known at compile-time |
15 |
| - | |
16 |
| - = help: the trait `std::marker::Sized` is not implemented for `str` |
17 |
| - = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> |
18 |
| - = note: slice and array elements must have `Sized` type |
19 |
| - |
20 |
| -error: aborting due to 2 previous errors |
| 9 | +error: aborting due to previous error |
21 | 10 |
|
22 |
| -Some errors occurred: E0277, E0308. |
23 |
| -For more information about an error, try `rustc --explain E0277`. |
| 11 | +For more information about this error, try `rustc --explain E0080`. |
0 commit comments