-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #49719 - mark-i-m:no_sep, r=petrochenkov
Update `?` repetition disambiguation. **Do not merge** (yet) This is a test implementation of some ideas from discussion in #48075 . This PR - disallows `?` repetition from taking a separator, since the separator is never used. - disallows the use of `?` as a separator. This allows patterns like `$(a)?+` to match `+` and `a+` rather than `a?a?a`. This is a _breaking change_, but maybe that's ok? Perhaps a crater run is the right approach? cc @durka @alexreg @nikomatsakis
- Loading branch information
Showing
4 changed files
with
72 additions
and
156 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,62 @@ | ||
error: `?` macro repetition does not allow a separator | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:22:10 | ||
| | ||
LL | ($(a),?) => {} //~ ERROR `?` macro repetition does not allow a separator | ||
| ^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:40:11 | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:36:11 | ||
| | ||
LL | foo!(a?a?a); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:41:11 | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:37:11 | ||
| | ||
LL | foo!(a?a); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:42:11 | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:38:11 | ||
| | ||
LL | foo!(a?); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:43:11 | ||
| | ||
LL | baz!(a?a?a); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:44:11 | ||
| | ||
LL | baz!(a?a); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:45:11 | ||
| | ||
LL | baz!(a?); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
|
||
error: unexpected end of macro invocation | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:46:11 | ||
| | ||
LL | baz!(a,); //~ ERROR unexpected end of macro invocation | ||
| ^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:47:11 | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:39:5 | ||
| | ||
LL | baz!(a?a?a,); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
LL | barplus!(); //~ ERROR unexpected end of macro invocation | ||
| ^^^^^^^^^^^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:48:11 | ||
error: unexpected end of macro invocation | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:40:5 | ||
| | ||
LL | baz!(a?a,); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
LL | barstar!(); //~ ERROR unexpected end of macro invocation | ||
| ^^^^^^^^^^^ | ||
|
||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:49:11 | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:41:15 | ||
| | ||
LL | baz!(a?,); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
LL | barplus!(a?); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
|
||
error: unexpected end of macro invocation | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:50:5 | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:42:14 | ||
| | ||
LL | barplus!(); //~ ERROR unexpected end of macro invocation | ||
| ^^^^^^^^^^^ | ||
LL | barplus!(a); //~ ERROR unexpected end of macro invocation | ||
| ^ | ||
|
||
error: unexpected end of macro invocation | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:51:15 | ||
error: no rules expected the token `?` | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:43:15 | ||
| | ||
LL | barplus!(a?); //~ ERROR unexpected end of macro invocation | ||
LL | barstar!(a?); //~ ERROR no rules expected the token `?` | ||
| ^ | ||
|
||
error: unexpected end of macro invocation | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:52:15 | ||
--> $DIR/macro-at-most-once-rep-ambig.rs:44:14 | ||
| | ||
LL | barstar!(a?); //~ ERROR unexpected end of macro invocation | ||
| ^ | ||
LL | barstar!(a); //~ ERROR unexpected end of macro invocation | ||
| ^ | ||
|
||
error: aborting due to 13 previous errors | ||
error: aborting due to 10 previous errors | ||
|