Don't lint for self-recursion when the function can diverge

This commit is contained in:
Jonas Schievink 2020-04-05 21:04:31 +02:00
parent b543afca9b
commit 87d859af24
3 changed files with 132 additions and 92 deletions

View file

@ -131,4 +131,22 @@ trait Bar {
}
}
// Do not trigger on functions that may diverge instead of self-recursing (#54444)
pub fn loops(x: bool) {
if x {
loops(x);
} else {
loop {}
}
}
pub fn panics(x: bool) {
if x {
panics(!x);
} else {
panic!("panics");
}
}
fn main() {}