]> git.lizzy.rs Git - rust.git/commit
Add a lint to detect unconditional recursion.
authorHuon Wilson <dbau.pp+github@gmail.com>
Wed, 31 Dec 2014 16:06:38 +0000 (03:06 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Sat, 24 Jan 2015 13:21:03 +0000 (00:21 +1100)
commitfbef241709093b3fb18cb12500fd33e4ab964b62
tree321f775a86430cc2dc03ad94b6f542252641f91f
parent000dc07f71baafc31da74e392ad5530fb6de9757
Add a lint to detect unconditional recursion.

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.
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/test/compile-fail/lint-unconditional-recursion.rs [new file with mode: 0644]