-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f650153
Parse bang macro as a statement when used in trailing expr position
Aaron1011 bb426ba
Work on macro_rules
Aaron1011 38b670e
Fix stdarch
Aaron1011 d1de799
Remove trailing semicolon on a bunch of macros
Aaron1011 b50d1c7
Temporarily allow rustdoc warnings for a `try` build
Aaron1011 2cdc3a4
Disable more -Dwarnings
Aaron1011 677d6cb
Use patched dependencies
Aaron1011 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule stdarch
updated
25 files
+4 −1 | .github/workflows/main.yml | |
+21 −8 | CONTRIBUTING.md | |
+2 −0 | ci/run.sh | |
+466 −462 | crates/core_arch/avx512f.md | |
+0 −3 | crates/core_arch/src/aarch64/mod.rs | |
+43 −15 | crates/core_arch/src/arm/crypto.rs | |
+5 −0 | crates/core_arch/src/arm/mod.rs | |
+125 −0 | crates/core_arch/src/arm/neon/mod.rs | |
+1 −1 | crates/core_arch/src/core_arch_docs.md | |
+1 −1 | crates/core_arch/src/lib.rs | |
+1 −0 | crates/core_arch/src/mod.rs | |
+196 −0 | crates/core_arch/src/simd.rs | |
+6 −6 | crates/core_arch/src/x86/avx.rs | |
+7 −7 | crates/core_arch/src/x86/avx2.rs | |
+25,645 −12,967 | crates/core_arch/src/x86/avx512f.rs | |
+524 −0 | crates/core_arch/src/x86/macros.rs | |
+29 −1 | crates/core_arch/src/x86/mod.rs | |
+9 −3 | crates/core_arch/src/x86/sse.rs | |
+16 −4 | crates/core_arch/src/x86/sse2.rs | |
+1 −1 | crates/core_arch/src/x86/sse41.rs | |
+25 −35 | crates/core_arch/src/x86/test.rs | |
+1,671 −196 | crates/core_arch/src/x86_64/avx512f.rs | |
+57 −48 | crates/stdarch-test/src/disassembly.rs | |
+34 −2 | crates/stdarch-verify/tests/x86-intel.rs | |
+303 −1 | crates/stdarch-verify/x86-intel.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ pub mod foo { | |
mod bar { | ||
fn f() -> u32 { 1 } | ||
pub macro m() { | ||
f(); | ||
f() | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// check-pass | ||
|
||
// Tests that we parse a bang macro | ||
// as a statement when it occurs in the trailing expression position, | ||
// which allows it to expand to a statement | ||
|
||
fn main() { | ||
macro_rules! a { | ||
($e:expr) => { $e; } | ||
} | ||
a!(true) | ||
} |
5 changes: 3 additions & 2 deletions
5
src/test/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
src/test/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
// check-pass | ||
|
||
macro_rules! empty { () => () } | ||
|
||
fn main() { | ||
match 42 { | ||
_ => { empty!() } | ||
//~^ ERROR macro expansion ends with an incomplete expression | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
// run-rustfix | ||
// check-pass | ||
|
||
macro_rules! foo { | ||
() => { | ||
assert_eq!("A", "A"); | ||
assert_eq!("B", "B"); | ||
} | ||
//~^^ ERROR macro expansion ignores token `assert_eq` and any following | ||
//~| NOTE the usage of `foo!` is likely invalid in expression context | ||
} | ||
|
||
fn main() { | ||
foo!() | ||
//~^ NOTE caused by the macro expansion here | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
error[E0658]: attributes on expressions are experimental | ||
--> $DIR/attr-stmt-expr.rs:10:5 | ||
| | ||
LL | #[expect_print_expr] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information | ||
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable | ||
|
||
error[E0658]: attributes on expressions are experimental | ||
--> $DIR/attr-stmt-expr.rs:23:5 | ||
--> $DIR/attr-stmt-expr.rs:21:5 | ||
| | ||
LL | #[expect_expr] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information | ||
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
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.