]> git.lizzy.rs Git - rust.git/blob - src/test/ui/cast/cast-as-bool.rs
Rollup merge of #97066 - petrochenkov:nofragkind, r=camelid
[rust.git] / src / test / ui / cast / cast-as-bool.rs
1 fn main() {
2     let u = 5 as bool; //~ ERROR cannot cast as `bool`
3                        //~| HELP compare with zero instead
4                        //~| SUGGESTION 5 != 0
5     let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool`
6                              //~| HELP compare with zero instead
7                              //~| SUGGESTION (1 + 2) != 0
8     let v = "hello" as bool; //~ ERROR casting `&'static str` as `bool` is invalid
9 }