summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lint/lint-impl-fn.rs
blob: 46874d95c32fb0ab7df960b67700eca32c379353 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![allow(while_true)]
#![allow(dead_code)]

struct A(isize);

impl A {
    fn foo(&self) { while true {} }

    #[deny(while_true)]
    fn bar(&self) { while true {} } //~ ERROR: infinite loops
}

#[deny(while_true)]
mod foo {
    struct B(isize);

    impl B {
        fn foo(&self) { while true {} } //~ ERROR: infinite loops

        #[allow(while_true)]
        fn bar(&self) { while true {} }
    }
}

#[deny(while_true)]
fn main() {
    while true {} //~ ERROR: infinite loops
}

#[deny(while_true)]
fn bar() {
    while cfg!(unix) {} // no error
}