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