Skip to content

Commit 9599066

Browse files
committed
rustc: remove misleading Ty::is_uint method.
1 parent 0a3761e commit 9599066

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/librustc/ty/sty.rs

-7
Original file line numberDiff line numberDiff line change
@@ -1478,13 +1478,6 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
14781478
}
14791479
}
14801480

1481-
pub fn is_uint(&self) -> bool {
1482-
match self.sty {
1483-
TyInfer(IntVar(_)) | TyUint(ast::UintTy::Us) => true,
1484-
_ => false
1485-
}
1486-
}
1487-
14881481
pub fn is_char(&self) -> bool {
14891482
match self.sty {
14901483
TyChar => true,

src/librustc_typeck/check/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
233233
CastError::NeedViaPtr => {
234234
let mut err = make_invalid_casting_error(fcx.tcx.sess, self.span, self.expr_ty,
235235
self.cast_ty, fcx);
236-
if self.cast_ty.is_uint() {
236+
if self.cast_ty.is_integral() {
237237
err.help(&format!("cast through {} first",
238238
match e {
239239
CastError::NeedViaPtr => "a raw pointer",

src/test/ui/fat-ptr-cast.stderr

+6
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,24 @@ error[E0606]: casting `&[i32]` as `isize` is invalid
1111
|
1212
21 | a as isize; //~ ERROR casting
1313
| ^^^^^^^^^^
14+
|
15+
= help: cast through a raw pointer first
1416

1517
error[E0606]: casting `&[i32]` as `i16` is invalid
1618
--> $DIR/fat-ptr-cast.rs:22:5
1719
|
1820
22 | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid
1921
| ^^^^^^^^
22+
|
23+
= help: cast through a raw pointer first
2024

2125
error[E0606]: casting `&[i32]` as `u32` is invalid
2226
--> $DIR/fat-ptr-cast.rs:23:5
2327
|
2428
23 | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid
2529
| ^^^^^^^^
30+
|
31+
= help: cast through a raw pointer first
2632

2733
error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize`
2834
--> $DIR/fat-ptr-cast.rs:24:5

0 commit comments

Comments
 (0)