Don't lint for self-recursion when the function can diverge
This commit is contained in:
parent
b543afca9b
commit
87d859af24
3 changed files with 132 additions and 92 deletions
|
|
@ -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() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue