-
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
Permit attributes on 'if' expressions #69201
Merged
Merged
Commits on Mar 4, 2020
-
Permit attributes on 'if' expressions
Previously, attributes on 'if' expressions (e.g. #[attr] if true {}) were disallowed during parsing. This made it impossible for macros to perform any custom handling of such attributes (e.g. stripping them away), since a compilation error would be emitted before they ever had a chance to run. This PR permits attributes on 'if' expressions ('if-attrs' from here on). Both built-in attributes (e.g. `#[allow]`, `#[cfg]`) are supported. We still do *not* accept attributes on 'other parts' of an if-else chain. That is, the following code snippet still fails to parse: ```rust if true {} #[attr] else if false {} else #[attr] if false {} #[attr] else {} ```
Configuration menu - View commit details
-
Copy full SHA for f63b88c - Browse repository at this point
Copy the full SHA f63b88cView commit details -
Configuration menu - View commit details
-
Copy full SHA for e912d9d - Browse repository at this point
Copy the full SHA e912d9dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e9ec47b - Browse repository at this point
Copy the full SHA e9ec47bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9a299e4 - Browse repository at this point
Copy the full SHA 9a299e4View commit details -
Configuration menu - View commit details
-
Copy full SHA for b00f674 - Browse repository at this point
Copy the full SHA b00f674View commit details -
Configuration menu - View commit details
-
Copy full SHA for e11cdfd - Browse repository at this point
Copy the full SHA e11cdfdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f19358 - Browse repository at this point
Copy the full SHA 7f19358View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1b681d6 - Browse repository at this point
Copy the full SHA 1b681d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 37c2c38 - Browse repository at this point
Copy the full SHA 37c2c38View commit details -
Configuration menu - View commit details
-
Copy full SHA for 66b152c - Browse repository at this point
Copy the full SHA 66b152cView commit details -
Configuration menu - View commit details
-
Copy full SHA for e50fd5a - Browse repository at this point
Copy the full SHA e50fd5aView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.