summary refs log tree commit diff
path: root/src/test/compile-fail/lint-unconditional-recursion.rs
AgeCommit message (Collapse)AuthorLines
2015-08-04rustc_lint: handle more method calls in unconditional_recursion.Eduard Burtescu-0/+66
2015-06-29lint: default methods must be called on Self to unconditionally recur.Huon Wilson-0/+7
This catches the case when a trait defines a default method that calls itself, but on a type that isn't necessarily `Self`, e.g. there's no reason that `T = Self` in the following, so the call isn't necessarily recursive (`T` may override the call). trait Bar { fn method<T: Bar>(&self, x: &T) { x.method(x) } } Fixes #26333.
2015-06-29lint: only consider actual calls as unconditional recursion.Huon Wilson-0/+4
Specifically, just mentioning the function name as a value is fine, as long as it isn't called, e.g. `fn main() { let _ = main; }`. Closes #21705.
2015-01-25Add a lint to detect unconditional recursion.Huon Wilson-0/+66
E.g. `fn foo() { foo() }`, or, more subtlely impl Foo for Box<Foo+'static> { fn bar(&self) { self.bar(); } } The compiler will warn and point out the points where recursion occurs, if it determines that the function cannot return without calling itself. Closes #17899.