2014-03-21 18:05:05 -07:00
|
|
|
#![allow(while_true)]
|
|
|
|
#![allow(dead_code)]
|
2013-04-30 01:15:17 -04:00
|
|
|
|
2015-01-08 21:54:35 +11:00
|
|
|
struct A(isize);
|
2013-04-30 01:15:17 -04:00
|
|
|
|
|
|
|
impl A {
|
|
|
|
fn foo(&self) { while true {} }
|
|
|
|
|
|
|
|
#[deny(while_true)]
|
|
|
|
fn bar(&self) { while true {} } //~ ERROR: infinite loops
|
|
|
|
}
|
|
|
|
|
|
|
|
#[deny(while_true)]
|
|
|
|
mod foo {
|
2015-01-08 21:54:35 +11:00
|
|
|
struct B(isize);
|
2013-04-30 01:15:17 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2017-09-01 17:45:46 +02:00
|
|
|
|
|
|
|
#[deny(while_true)]
|
|
|
|
fn bar() {
|
|
|
|
while cfg!(unix) {} // no error
|
|
|
|
}
|