-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too many warnings with the new unconditional_recursion lint #21705
Comments
cc @huonw |
Wow, I considered situations like this, but I didn't think it would occur often, or at all; I think I was too optimistic. I assume your example is reduced from a larger one; out of interest, what's your use for unconditionally referring to a function inside itself? |
Well. Actually this code is just part of some examples I put together for testing what types stuff has. Nothing for production or with real meaning.
Are all the cases I have in that. I had the same warning with the pretty fresh parser-combinators crate which was topic in reddit a day ago. There I get a warning for this:
https://github.com/Marwes/parser-combinators/blob/master/src/primitives.rs#L235 Which also seems not right to me. I just posted my "print_type_of(&main)" example because I thought it is pretty obviously not what we should get a warning for :) |
Ah I see. By the way, the latter is actually incorrect: |
I recently ran into this as well when passing |
I noticed this when writing a ffi that uses callbacks. If the callback calls a function and passes itself as a parameter, this warning triggers. Obviously we don't know anything about the foreign function and therefore it might be true. But it's not really unconditional recursion. PlayPen Example pub type Callback = extern fn();
extern {
pub fn something(arg: Callback);
}
extern fn cb() {
unsafe{ something(cb); }
} |
I think the new unconditional_recursion lint has a bug. For example I get a warning for this code:
rustc 1.0.0-nightly (458a6a2 2015-01-25 21:20:37 +0000)
The text was updated successfully, but these errors were encountered: