fat-ptr-cast.stderr 2.1 KB
Newer Older
1 2 3
error[E0606]: casting `&[i32]` as `usize` is invalid
  --> $DIR/fat-ptr-cast.rs:20:5
   |
V
Vadim Petrochenkov 已提交
4
LL |     a as usize; //~ ERROR casting
5 6 7 8 9
   |     ^^^^^^^^^^
   |
   = help: cast through a raw pointer first

error[E0606]: casting `&[i32]` as `isize` is invalid
10
  --> $DIR/fat-ptr-cast.rs:21:5
11
   |
V
Vadim Petrochenkov 已提交
12
LL |     a as isize; //~ ERROR casting
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:22:5
19
   |
V
Vadim Petrochenkov 已提交
20
LL |     a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid
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:23:5
27
   |
V
Vadim Petrochenkov 已提交
28
LL |     a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid
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:24:5
35
   |
V
Vadim Petrochenkov 已提交
36
LL |     b as usize; //~ ERROR non-primitive cast
37 38 39 40 41
   |     ^^^^^^^^^^
   |
   = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait

error[E0606]: casting `*const [i32]` as `usize` is invalid
42
  --> $DIR/fat-ptr-cast.rs:25:5
43
   |
V
Vadim Petrochenkov 已提交
44
LL |     p as usize;
45 46 47 48 49
   |     ^^^^^^^^^^
   |
   = help: cast through a thin pointer first

error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]`
50
  --> $DIR/fat-ptr-cast.rs:29:5
51
   |
V
Vadim Petrochenkov 已提交
52
LL |     q as *const [i32]; //~ ERROR cannot cast
53 54
   |     ^^^^^^^^^^^^^^^^^

55
error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid
56
  --> $DIR/fat-ptr-cast.rs:32:37
57
   |
V
Vadim Petrochenkov 已提交
58
LL |     let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting
59 60 61
   |                                     ^^^^^^^^^^^

error[E0606]: casting `usize` as `*const str` is invalid
62
  --> $DIR/fat-ptr-cast.rs:33:32
63
   |
V
Vadim Petrochenkov 已提交
64
LL |     let mut fail: *const str = 0 as *const str; //~ ERROR casting
65 66 67 68
   |                                ^^^^^^^^^^^^^^^

error: aborting due to 9 previous errors

G
Guillaume Gomez 已提交
69 70
Some errors occurred: E0605, E0606, E0607.
For more information about an error, try `rustc --explain E0605`.