#![deny(unconditional_recursion)]
#![allow(dead_code)]
-fn foo() { //~ ERROR function cannot return without recurring
+fn foo() { //~ ERROR function cannot return without recursing
foo();
}
}
}
-fn baz() { //~ ERROR function cannot return without recurring
+fn baz() { //~ ERROR function cannot return without recursing
if true {
baz()
} else {
loop {}
}
-fn quz() -> bool { //~ ERROR function cannot return without recurring
+fn quz() -> bool { //~ ERROR function cannot return without recursing
if true {
while quz() {}
true
// Trait method calls.
trait Foo {
- fn bar(&self) { //~ ERROR function cannot return without recurring
+ fn bar(&self) { //~ ERROR function cannot return without recursing
self.bar()
}
}
impl Foo for Box<Foo+'static> {
- fn bar(&self) { //~ ERROR function cannot return without recurring
+ fn bar(&self) { //~ ERROR function cannot return without recursing
loop {
self.bar()
}
// Trait method call with integer fallback after method resolution.
impl Foo for i32 {
- fn bar(&self) { //~ ERROR function cannot return without recurring
+ fn bar(&self) { //~ ERROR function cannot return without recursing
0.bar()
}
}
// Trait method calls via paths.
trait Foo2 {
- fn bar(&self) { //~ ERROR function cannot return without recurring
+ fn bar(&self) { //~ ERROR function cannot return without recursing
Foo2::bar(self)
}
}
impl Foo2 for Box<Foo2+'static> {
- fn bar(&self) { //~ ERROR function cannot return without recurring
+ fn bar(&self) { //~ ERROR function cannot return without recursing
loop {
Foo2::bar(self)
}
struct Baz;
impl Baz {
// Inherent method call.
- fn qux(&self) { //~ ERROR function cannot return without recurring
+ fn qux(&self) { //~ ERROR function cannot return without recursing
self.qux();
}
// Inherent method call via path.
- fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring
+ fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recursing
Baz::as_ref(self)
}
}
// Trait method calls to impls via paths.
impl Default for Baz {
- fn default() -> Baz { //~ ERROR function cannot return without recurring
+ fn default() -> Baz { //~ ERROR function cannot return without recursing
let x = Default::default();
x
}
// Overloaded operators.
impl std::ops::Deref for Baz {
type Target = ();
- fn deref(&self) -> &() { //~ ERROR function cannot return without recurring
+ fn deref(&self) -> &() { //~ ERROR function cannot return without recursing
&**self
}
}
impl std::ops::Index<usize> for Baz {
type Output = Baz;
- fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring
+ fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recursing
&self[x]
}
}
struct Quux;
impl std::ops::Deref for Quux {
type Target = Baz;
- fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring
+ fn deref(&self) -> &Baz { //~ ERROR function cannot return without recursing
self.as_ref()
}
}
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:14:1
|
-LL | fn foo() { //~ ERROR function cannot return without recurring
- | ^^^^^^^^ cannot return without recurring
+LL | fn foo() { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^ cannot return without recursing
LL | foo();
| ----- recursive call site
|
| ^^^^^^^^^^^^^^^^^^^^^^^
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:24:1
|
-LL | fn baz() { //~ ERROR function cannot return without recurring
- | ^^^^^^^^ cannot return without recurring
+LL | fn baz() { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^ cannot return without recursing
LL | if true {
LL | baz()
| ----- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:36:1
|
-LL | fn quz() -> bool { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^^^^ cannot return without recurring
+LL | fn quz() -> bool { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^^^^ cannot return without recursing
LL | if true {
LL | while quz() {}
| ----- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:47:5
|
-LL | fn bar(&self) { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^ cannot return without recurring
+LL | fn bar(&self) { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^ cannot return without recursing
LL | self.bar()
| ---------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:53:5
|
-LL | fn bar(&self) { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^ cannot return without recurring
+LL | fn bar(&self) { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^ cannot return without recursing
LL | loop {
LL | self.bar()
| ---------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:62:5
|
-LL | fn bar(&self) { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^ cannot return without recurring
+LL | fn bar(&self) { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^ cannot return without recursing
LL | 0.bar()
| ------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:75:5
|
-LL | fn bar(&self) { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^ cannot return without recurring
+LL | fn bar(&self) { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^ cannot return without recursing
LL | Foo2::bar(self)
| --------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:81:5
|
-LL | fn bar(&self) { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^ cannot return without recurring
+LL | fn bar(&self) { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^ cannot return without recursing
LL | loop {
LL | Foo2::bar(self)
| --------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:91:5
|
-LL | fn qux(&self) { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^ cannot return without recurring
+LL | fn qux(&self) { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^ cannot return without recursing
LL | self.qux();
| ---------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:96:5
|
-LL | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
+LL | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
LL | Baz::as_ref(self)
| ----------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:103:5
|
-LL | fn default() -> Baz { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^^^^^^^ cannot return without recurring
+LL | fn default() -> Baz { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^^^^^^^ cannot return without recursing
LL | let x = Default::default();
| ------------------ recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:112:5
|
-LL | fn deref(&self) -> &() { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
+LL | fn deref(&self) -> &() { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
LL | &**self
| ------ recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:119:5
|
-LL | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
+LL | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
LL | &self[x]
| ------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
-error: function cannot return without recurring
+error: function cannot return without recursing
--> $DIR/lint-unconditional-recursion.rs:128:5
|
-LL | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring
- | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
+LL | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recursing
+ | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
LL | self.as_ref()
| ---- recursive call site
|