Skip to content

Commit 820c810

Browse files
author
Knight
committed
Updated E0054 to new format
1 parent 1576de0 commit 820c810

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/librustc_typeck/check/cast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
161161
}
162162
CastError::CastToBool => {
163163
struct_span_err!(fcx.tcx.sess, self.span, E0054, "cannot cast as `bool`")
164+
.span_label(self.span, &format!("unsupported cast"))
164165
.help("compare with zero instead")
165166
.emit();
166167
}

src/test/compile-fail/cast-rfc0401.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ fn main()
5959
//~^ ERROR casting
6060
//~^^ HELP through a usize first
6161
let _ = 3_i32 as bool;
62-
//~^ ERROR cannot cast as `bool`
62+
//~^ ERROR cannot cast as `bool` [E0054]
63+
//~| unsupported cast
6364
//~| HELP compare with zero
6465
let _ = E::A as bool;
65-
//~^ ERROR cannot cast as `bool`
66+
//~^ ERROR cannot cast as `bool` [E0054]
67+
//~| unsupported cast
6668
//~| HELP compare with zero
6769
let _ = 0x61u32 as char; //~ ERROR only `u8` can be cast
6870

0 commit comments

Comments
 (0)