Skip to content

Commit 041c9f6

Browse files
Clean up E0054
1 parent 1a3c8c8 commit 041c9f6

File tree

1 file changed

+6
-2
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+6
-2
lines changed

src/librustc_error_codes/error_codes/E0054.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
It is not allowed to cast to a bool. If you are trying to cast a numeric type
2-
to a bool, you can compare it with zero instead:
1+
It is not allowed to cast to a bool.
2+
3+
Erroneous code example:
34

45
```compile_fail,E0054
56
let x = 5;
@@ -8,6 +9,9 @@ let x = 5;
89
let x_is_nonzero = x as bool;
910
```
1011

12+
If you are trying to cast a numeric type to a bool, you can compare it with
13+
zero instead:
14+
1115
```
1216
let x = 5;
1317

0 commit comments

Comments
 (0)