]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/lint-impl-fn.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / ui / lint / lint-impl-fn.rs
1 #![allow(while_true)]
2 #![allow(dead_code)]
3
4 struct A(isize);
5
6 impl A {
7     fn foo(&self) { while true {} }
8
9     #[deny(while_true)]
10     fn bar(&self) { while true {} } //~ ERROR: infinite loops
11 }
12
13 #[deny(while_true)]
14 mod foo {
15     struct B(isize);
16
17     impl B {
18         fn foo(&self) { while true {} } //~ ERROR: infinite loops
19
20         #[allow(while_true)]
21         fn bar(&self) { while true {} }
22     }
23 }
24
25 #[deny(while_true)]
26 fn main() {
27     while true {} //~ ERROR: infinite loops
28 }
29
30 #[deny(while_true)]
31 fn bar() {
32     while cfg!(unix) {} // no error
33 }