Rollup merge of #70822 - jonas-schievink:curse-of-the-recursion, r=ecstatic-morse

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

Fixes https://github.com/rust-lang/rust/issues/54444
This commit is contained in:
Mazdak Farrokhzad 2020-04-09 05:29:40 +02:00 committed by GitHub
commit a209b4f447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 151 additions and 96 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() {}