about summary refs log tree commit diff
path: root/src/test/ui/lint/lint-unconditional-recursion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/lint/lint-unconditional-recursion.rs')
-rw-r--r--src/test/ui/lint/lint-unconditional-recursion.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/lint/lint-unconditional-recursion.rs b/src/test/ui/lint/lint-unconditional-recursion.rs
index ab60a326cd2..d2a0329585b 100644
--- a/src/test/ui/lint/lint-unconditional-recursion.rs
+++ b/src/test/ui/lint/lint-unconditional-recursion.rs
@@ -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() {}