diff --git a/tests/ui/only_used_in_recursion.rs b/tests/ui/only_used_in_recursion.rs index 799adfd3b..0f49fc071 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 b2dd99bbe..c24a357cd 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