about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/only_used_in_recursion.rs10
-rw-r--r--tests/ui/only_used_in_recursion.stderr8
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/ui/only_used_in_recursion.rs b/tests/ui/only_used_in_recursion.rs
index 799adfd3be2..0f49fc071bf 100644
--- a/tests/ui/only_used_in_recursion.rs
+++ b/tests/ui/only_used_in_recursion.rs
@@ -86,6 +86,16 @@ impl B for A {
     }
 }
 
+trait C {
+    fn hello(a: usize, b: usize) -> usize {
+        if a == 0 { 1 } else { Self::hello(a - 1, b + 1) }
+    }
+
+    fn hello2(&self, a: usize, b: usize) -> usize {
+        if a == 0 { 1 } else { self.hello2(a - 1, b + 1) }
+    }
+}
+
 fn ignore(a: usize, _: usize) -> usize {
     if a == 1 { 1 } else { ignore(a - 1, 0) }
 }
diff --git a/tests/ui/only_used_in_recursion.stderr b/tests/ui/only_used_in_recursion.stderr
index b2dd99bbe4d..c24a357cd20 100644
--- a/tests/ui/only_used_in_recursion.stderr
+++ b/tests/ui/only_used_in_recursion.stderr
@@ -66,5 +66,11 @@ error: parameter is only used in recursion
 LL |     fn method2(&self, a: usize, b: usize) -> usize {
    |                                 ^ help: if this is intentional, prefix with an underscore: `_b`
 
-error: aborting due to 11 previous errors
+error: parameter is only used in recursion
+  --> $DIR/only_used_in_recursion.rs:94:32
+   |
+LL |     fn hello2(&self, a: usize, b: usize) -> usize {
+   |                                ^ help: if this is intentional, prefix with an underscore: `_b`
+
+error: aborting due to 12 previous errors