}
}
- pub fn is_uint(&self) -> bool {
- match self.sty {
- TyInfer(IntVar(_)) | TyUint(ast::UintTy::Us) => true,
- _ => false
- }
- }
-
pub fn is_char(&self) -> bool {
match self.sty {
TyChar => true,
CastError::NeedViaPtr => {
let mut err = make_invalid_casting_error(fcx.tcx.sess, self.span, self.expr_ty,
self.cast_ty, fcx);
- if self.cast_ty.is_uint() {
+ if self.cast_ty.is_integral() {
err.help(&format!("cast through {} first",
match e {
CastError::NeedViaPtr => "a raw pointer",
|
21 | 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
|
22 | 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
|
23 | 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