-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[DO NOT MERGE] Consistent handling of semicolons in macro expansions #78685
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
|
@bors try |
r? @ghost |
⌛ Trying commit 6522b7a82e35fe64fa731578724e8e861c5dbd84 with merge 1a1b32118e83a86f430f0c6665d870751ca08118... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors try |
⌛ Trying commit 2f6d12cf5b3469a4b1cd57098ae1366f3fe47f16 with merge ea2a67936e3f9b71d6067d67723b66bac8d387b4... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors try |
⌛ Trying commit 003157547b12ef2b81db5aaa223070614b3a4327 with merge bc19ff65d7d862e3bca14037b3c0cb818328cfcc... |
@@ -125,7 +125,7 @@ pub(super) fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> { | |||
let old_offset = index; | |||
macro_rules! err { | |||
($error_len: expr) => { | |||
return Err(Utf8Error { valid_up_to: old_offset, error_len: $error_len }); | |||
return Err(Utf8Error { valid_up_to: old_offset, error_len: $error_len }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Err(Utf8Error { valid_up_to: old_offset, error_len: $error_len }) | |
Err(Utf8Error { valid_up_to: old_offset, error_len: $error_len }) |
Is return
required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - for example, https://github.com/Aaron1011/rust/blob/003157547b12ef2b81db5aaa223070614b3a4327/library/core/src/str/validations.rs#L136-L138 uses this to bail out early.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The build doesn't even complete because of Opened dtolnay/anyhow#120. The fact that three different crates ( |
cc rust-lang#33953 Currently, the following code produces an error ```rust fn main() { macro_rules! a { ($e:expr) => { $e; } } a!(true) } ```
0031575
to
677d6cb
Compare
@bors try |
⌛ Trying commit 677d6cb with merge 1cd838451943835da5228ec71c7bae5b8268efdd... |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
💔 Test failed - checks-actions |
☔ The latest upstream changes (presumably #79167) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
Closing due to inactivity. |
Implements 'Proposal 2' from #61733 (comment)
This PR treats semicolon-less macro invocations like statements. This allows the following code to compile:
To avoid making macro behavior more inconsistent, macros expanded in expression position no longer ignore trailing semicolons in the expansion. This broke several things in the standard library - in fact, we can't even get rustfmt to pass until rust-lang/rustfmt#4507 is merged
Given all of the issues this has expoesd with the standard library (and many test cases), I expect this to cause a significant amount of ecosystem breakage. I'm opening this for a Crater run - we'll almost certainly need to do a gradual rollout if this is accepted. Fortunately, it's easy to convert the
macro_rules!
error into a warning.