Updated E0054 to new format

This commit is contained in:
Knight 2016-08-22 13:51:21 +08:00
parent 1576de0ce6
commit 820c810107
2 changed files with 5 additions and 2 deletions

View file

@ -161,6 +161,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
}
CastError::CastToBool => {
struct_span_err!(fcx.tcx.sess, self.span, E0054, "cannot cast as `bool`")
.span_label(self.span, &format!("unsupported cast"))
.help("compare with zero instead")
.emit();
}

View file

@ -59,10 +59,12 @@ fn main()
//~^ ERROR casting
//~^^ HELP through a usize first
let _ = 3_i32 as bool;
//~^ ERROR cannot cast as `bool`
//~^ ERROR cannot cast as `bool` [E0054]
//~| unsupported cast
//~| HELP compare with zero
let _ = E::A as bool;
//~^ ERROR cannot cast as `bool`
//~^ ERROR cannot cast as `bool` [E0054]
//~| unsupported cast
//~| HELP compare with zero
let _ = 0x61u32 as char; //~ ERROR only `u8` can be cast