forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax: Unsupport
foo! bar { ... }
macros in the parser
Unreserve `macro_rules` as a macro name
- Loading branch information
1 parent
5748825
commit 3f39dc1
Showing
11 changed files
with
70 additions
and
186 deletions.
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
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,38 +1,14 @@ | ||
error: macros that expand to items must be delimited with braces or followed by a semicolon | ||
--> $DIR/issue-10536.rs:14:22 | ||
error: expected open delimiter | ||
--> $DIR/issue-10536.rs:14:19 | ||
| | ||
LL | assert!({one! two()}); | ||
| ^^ | ||
help: change the delimiters to curly braces | ||
| | ||
LL | assert!({one! two {}}); | ||
| ^^ | ||
help: add a semicolon | ||
| | ||
LL | assert!({one! two();}); | ||
| ^ | ||
| ^^^ expected open delimiter | ||
|
||
error: expected `(` or `{`, found `}` | ||
--> $DIR/issue-10536.rs:21:22 | ||
error: expected open delimiter | ||
--> $DIR/issue-10536.rs:18:19 | ||
| | ||
LL | assert!({one! two}); | ||
| ^ expected `(` or `{` | ||
|
||
error: cannot find macro `one!` in this scope | ||
--> $DIR/issue-10536.rs:14:14 | ||
| | ||
LL | assert!({one! two()}); | ||
| ^^^ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-10536.rs:14:13 | ||
| | ||
LL | assert!({one! two()}); | ||
| ^^^^^^^^^^^^ expected bool, found () | ||
| | ||
= note: expected type `bool` | ||
found type `()` | ||
| ^^^ expected open delimiter | ||
|
||
error: aborting due to 4 previous errors | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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,3 +1,3 @@ | ||
fn main() { | ||
foo! bar < //~ ERROR expected `(` or `{`, found `<` | ||
foo! bar < //~ ERROR expected open delimiter | ||
} |
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,8 @@ | ||
error: expected `(` or `{`, found `<` | ||
--> $DIR/macro-bad-delimiter-ident.rs:2:14 | ||
error: expected open delimiter | ||
--> $DIR/macro-bad-delimiter-ident.rs:2:10 | ||
| | ||
LL | foo! bar < | ||
| ^ expected `(` or `{` | ||
| ^^^ expected open delimiter | ||
|
||
error: aborting due to previous error | ||
|
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,5 +1,9 @@ | ||
#![allow(unused_macros)] | ||
// check-pass | ||
|
||
macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules` | ||
macro_rules! macro_rules { () => { struct S; } } // OK | ||
|
||
fn main() {} | ||
macro_rules! {} // OK, calls the macro defined above | ||
|
||
fn main() { | ||
let s = S; | ||
} |
Oops, something went wrong.