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