about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNick Hamann <nick@wabbo.org>2015-05-07 14:34:54 -0500
committerNick Hamann <nick@wabbo.org>2015-05-07 14:34:54 -0500
commit11a7bad97b79014aa145af11c6537843cb086b78 (patch)
tree2e2c7455fb9ea11905c084d7e377246cd5824856
parent11cb5e50ab0fb166372d3aab68a06d5c06fdf2eb (diff)
downloadrust-11a7bad97b79014aa145af11c6537843cb086b78.tar.gz
rust-11a7bad97b79014aa145af11c6537843cb086b78.zip
Add long diagnostic for E0054
-rw-r--r--src/librustc_typeck/diagnostics.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs
index c8b106db65e..f00f0eea1f4 100644
--- a/src/librustc_typeck/diagnostics.rs
+++ b/src/librustc_typeck/diagnostics.rs
@@ -19,6 +19,21 @@ methods that do not have default implementations), as well as any required
 trait items like associated types or constants.
 "##,
 
+E0054: r##"
+It is not allowed to cast to a bool. If you are trying to cast a numeric type
+to a bool, you can compare it with zero instead:
+
+```
+let x = 5;
+
+// Ok
+let x_is_nonzero = x != 0;
+
+// Not allowed, won't compile
+let x_is_nonzero = x as bool;
+```
+"##,
+
 E0081: r##"
 Enum discriminants are used to differentiate enum variants stored in memory.
 This error indicates that the same value was used for two or more variants,
@@ -116,7 +131,6 @@ register_diagnostics! {
     E0049,
     E0050,
     E0053,
-    E0054,
     E0055,
     E0057,
     E0059,