2017-12-10 13:47:55 -06:00
|
|
|
error[E0606]: casting `&[i32]` as `usize` is invalid
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/fat-ptr-cast.rs:10:5
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | a as usize;
|
2017-12-10 13:47:55 -06:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: cast through a raw pointer first
|
|
|
|
|
|
|
|
error[E0606]: casting `&[i32]` as `isize` is invalid
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/fat-ptr-cast.rs:11:5
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | a as isize;
|
2017-12-10 13:47:55 -06:00
|
|
|
| ^^^^^^^^^^
|
2018-01-03 18:14:53 -06:00
|
|
|
|
|
|
|
|
= help: cast through a raw pointer first
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
|
|
error[E0606]: casting `&[i32]` as `i16` is invalid
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/fat-ptr-cast.rs:12:5
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | a as i16;
|
2017-12-10 13:47:55 -06:00
|
|
|
| ^^^^^^^^
|
2018-01-03 18:14:53 -06:00
|
|
|
|
|
|
|
|
= help: cast through a raw pointer first
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
|
|
error[E0606]: casting `&[i32]` as `u32` is invalid
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/fat-ptr-cast.rs:13:5
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | a as u32;
|
2017-12-10 13:47:55 -06:00
|
|
|
| ^^^^^^^^
|
2018-01-03 18:14:53 -06:00
|
|
|
|
|
|
|
|
= help: cast through a raw pointer first
|
2017-12-10 13:47:55 -06:00
|
|
|
|
2020-09-02 02:40:56 -05:00
|
|
|
error[E0605]: non-primitive cast: `Box<[i32]>` as `usize`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/fat-ptr-cast.rs:14:5
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | b as usize;
|
2020-06-14 23:36:25 -05:00
|
|
|
| ^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
|
|
error[E0606]: casting `*const [i32]` as `usize` is invalid
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/fat-ptr-cast.rs:15:5
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | p as usize;
|
2017-12-10 13:47:55 -06:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: cast through a thin pointer first
|
|
|
|
|
|
|
|
error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/fat-ptr-cast.rs:19:5
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | q as *const [i32];
|
2017-12-10 13:47:55 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
2022-03-09 17:24:14 -06:00
|
|
|
error[E0606]: cannot cast `usize` to a pointer that is wide
|
|
|
|
--> $DIR/fat-ptr-cast.rs:22:46
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2019-05-28 13:46:13 -05:00
|
|
|
LL | let t: *mut (dyn Trait + 'static) = 0 as *mut _;
|
2022-03-09 17:24:14 -06:00
|
|
|
| - ^^^^^^ creating a `*mut (dyn Trait + 'static)` requires both an address and a vtable
|
|
|
|
| |
|
|
|
|
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
|
2017-12-10 13:47:55 -06:00
|
|
|
|
2022-03-09 17:24:14 -06:00
|
|
|
error[E0606]: cannot cast `usize` to a pointer that is wide
|
|
|
|
--> $DIR/fat-ptr-cast.rs:24:37
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let mut fail: *const str = 0 as *const str;
|
2022-03-09 17:24:14 -06:00
|
|
|
| - ^^^^^^^^^^ creating a `*const str` requires both an address and a length
|
|
|
|
| |
|
|
|
|
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
|
2017-12-10 13:47:55 -06:00
|
|
|
|
2022-03-09 17:24:14 -06:00
|
|
|
error[E0606]: cannot cast `isize` to a pointer that is wide
|
|
|
|
--> $DIR/fat-ptr-cast.rs:26:43
|
|
|
|
|
|
|
|
|
LL | let mut fail2: *const str = 0isize as *const str;
|
|
|
|
| ------ ^^^^^^^^^^ creating a `*const str` requires both an address and a length
|
|
|
|
| |
|
|
|
|
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
|
|
|
|
|
|
|
|
error[E0606]: cannot cast `usize` to a pointer that may be wide
|
|
|
|
--> $DIR/fat-ptr-cast.rs:31:18
|
|
|
|
|
|
|
|
|
LL | let s = 0 as *const T;
|
|
|
|
| - ^^^^^^^^ creating a `*const T` requires both an address and type-specific metadata
|
|
|
|
| |
|
|
|
|
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
|
|
|
|
|
|
|
|
error: aborting due to 11 previous errors
|
2017-12-10 13:47:55 -06:00
|
|
|
|
2019-04-17 12:26:38 -05:00
|
|
|
Some errors have detailed explanations: E0605, E0606, E0607.
|
2018-03-03 08:59:40 -06:00
|
|
|
For more information about an error, try `rustc --explain E0605`.
|