fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.9 KiB70 linesraw
1error[E0606]: casting `&[i32]` as `usize` is invalid
2  --> $DIR/fat-ptr-cast.rs:10:5
3   |
4LL |     a as usize;
5   |     ^^^^^^^^^^
6   |
7   = help: cast through a raw pointer first
8
9error[E0606]: casting `&[i32]` as `isize` is invalid
10  --> $DIR/fat-ptr-cast.rs:11:5
11   |
12LL |     a as isize;
13   |     ^^^^^^^^^^
14   |
15   = help: cast through a raw pointer first
16
17error[E0606]: casting `&[i32]` as `i16` is invalid
18  --> $DIR/fat-ptr-cast.rs:12:5
19   |
20LL |     a as i16;
21   |     ^^^^^^^^
22   |
23   = help: cast through a raw pointer first
24
25error[E0606]: casting `&[i32]` as `u32` is invalid
26  --> $DIR/fat-ptr-cast.rs:13:5
27   |
28LL |     a as u32;
29   |     ^^^^^^^^
30   |
31   = help: cast through a raw pointer first
32
33error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize`
34  --> $DIR/fat-ptr-cast.rs:14:5
35   |
36LL |     b as usize;
37   |     ^^^^^^^^^^
38   |
39   = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
40
41error[E0606]: casting `*const [i32]` as `usize` is invalid
42  --> $DIR/fat-ptr-cast.rs:15:5
43   |
44LL |     p as usize;
45   |     ^^^^^^^^^^
46   |
47   = help: cast through a thin pointer first
48
49error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]`
50  --> $DIR/fat-ptr-cast.rs:19:5
51   |
52LL |     q as *const [i32];
53   |     ^^^^^^^^^^^^^^^^^
54
55error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid
56  --> $DIR/fat-ptr-cast.rs:22:41
57   |
58LL |     let t: *mut (dyn Trait + 'static) = 0 as *mut _;
59   |                                         ^^^^^^^^^^^
60
61error[E0606]: casting `usize` as `*const str` is invalid
62  --> $DIR/fat-ptr-cast.rs:23:32
63   |
64LL |     let mut fail: *const str = 0 as *const str;
65   |                                ^^^^^^^^^^^^^^^
66
67error: aborting due to 9 previous errors
68
69Some errors have detailed explanations: E0605, E0606, E0607.
70For more information about an error, try `rustc --explain E0605`.