rustc: remove misleading Ty::is_uint
method.
This commit is contained in:
parent
0a3761e63e
commit
9599066dcb
@ -1478,13 +1478,6 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
|
||||
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",
|
||||
|
@ -11,18 +11,24 @@ error[E0606]: casting `&[i32]` as `isize` is invalid
|
||||
|
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user