]> git.lizzy.rs Git - rust.git/blob - tests/ui/cast/cast-as-bool.stderr
Rollup merge of #106829 - compiler-errors:more-alias-combine, r=spastorino
[rust.git] / tests / ui / cast / cast-as-bool.stderr
1 error[E0054]: cannot cast as `bool`
2   --> $DIR/cast-as-bool.rs:2:13
3    |
4 LL |     let u = 5 as bool;
5    |             ^^^^^^^^^ help: compare with zero instead: `5 != 0`
6
7 error[E0054]: cannot cast as `bool`
8   --> $DIR/cast-as-bool.rs:6:13
9    |
10 LL |     let t = (1 + 2) as bool;
11    |             ^^^^^^^^^^^^^^^ help: compare with zero instead: `(1 + 2) != 0`
12
13 error[E0606]: casting `&'static str` as `bool` is invalid
14   --> $DIR/cast-as-bool.rs:10:13
15    |
16 LL |     let v = "hello" as bool;
17    |             ^^^^^^^^^^^^^^^
18    |
19 help: consider using the `is_empty` method on `&'static str` to determine if it contains anything
20    |
21 LL |     let v = !"hello".is_empty();
22    |             +       ~~~~~~~~~~~
23
24 error: aborting due to 3 previous errors
25
26 Some errors have detailed explanations: E0054, E0606.
27 For more information about an error, try `rustc --explain E0054`.