-
Notifications
You must be signed in to change notification settings - Fork 13.3k
while cfg!(unix) { ... }
suggests to use loop
instead
#43268
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
Comments
@oli-obk Hmm, |
@jseyfried this is messing up clippy pretty bad. Any idea where to start looking? |
So I tried to figure out what's going on, but I got lost in the code. As far as I can see it https://github.com/rust-lang/rust/blob/master/src/libsyntax/ext/expand.rs#L486 should be setting the expansion info. But it appears the |
@oli-obk The span passed to https://github.com/rust-lang/rust/blob/master/src/libsyntax/ext/expand.rs#L492 is the call site span, so it shouldn't contain the expansion info. The issue here is that To fix this, the Are there other built-in macros that also have this problem in practice or is it just |
I'd assume others have it too, but I'll check. So the passed call site span should only be used directly for error reporting, but never for creating ast items? |
Right, unless you want an AST item with the raw (unexpanded) call site span -- I don't think we ever want that. |
Produce expansion info for more builtin macros r? @jseyfried fixes #43268
Produce expansion info for more builtin macros r? @jseyfried fixes #43268
Produce expansion info for more builtin macros r? @jseyfried fixes #43268
If any linting or suggestion is done in this case, it should suggest
if cfg!(unix) { loop { ... } }
cc @jseyfried this has been in rustc forever, but clippy is only lately going crazy on it. Could this have come from your PR, too?
The text was updated successfully, but these errors were encountered: