You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pyriphlegethon opened this issue
Nov 1, 2015
· 2 comments
Labels
A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying types
Although recursion isn't bad in and of itself, it can often lead to infinite loops. Also some companies don't allow their programmers to use recursion (See this well known paper by NASA).
Jonathan Blow implemented a similar lint for his new programming language in this video.
This lint should probably be allow by default, because in most cases recursion is fine to use.
The text was updated successfully, but these errors were encountered:
Manishearth
added
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
T-middle
Type: Probably requires verifiying types
A-lint
Area: New lints
labels
Nov 1, 2015
I guess this issue has not been solved because it is quite complex to do.
There is however a simple pattern that may be detected without too much difficulties (I personnaly do quite often this mistake):
warning: function cannot return without recursing
--> src/lib.rs:8:5
|
8 | pub fn a_field(&self) -> &[Something] {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
9 | &self.a_field()
| -------------- recursive call site
|
= note: #[warn(unconditional_recursion)] on by default
= help: a `loop` may express intention better if this is on purpose
A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying types
Although recursion isn't bad in and of itself, it can often lead to infinite loops. Also some companies don't allow their programmers to use recursion (See this well known paper by NASA).
Jonathan Blow implemented a similar lint for his new programming language in this video.
This lint should probably be allow by default, because in most cases recursion is fine to use.
The text was updated successfully, but these errors were encountered: