From 820c8101077c430e6fc10481782f5df0862c279c Mon Sep 17 00:00:00 2001 From: Knight Date: Mon, 22 Aug 2016 13:51:21 +0800 Subject: [PATCH] Updated E0054 to new format --- src/librustc_typeck/check/cast.rs | 1 + src/test/compile-fail/cast-rfc0401.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index fb78d3a37ca2..54e63497e620 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -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(); } diff --git a/src/test/compile-fail/cast-rfc0401.rs b/src/test/compile-fail/cast-rfc0401.rs index 05c531e91f12..7839fb45d1c3 100644 --- a/src/test/compile-fail/cast-rfc0401.rs +++ b/src/test/compile-fail/cast-rfc0401.rs @@ -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