forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#111923 - c410-f3r:impl, r=oli-obk
[RFC-3086] Consider out-of-bound depths of `count` Fix rust-lang#111905 In the matching of macro calls and their respective declarations (transcribe), a warning is issued if `count` has a depth greater than the number of nested `NamedMatch`s through be verification of `MatchedSeq` with empty elements. Doesn't affect `( $( { $( [ $( ( $( $t:ident )* ) )* ] )* } )* ) => { ${count(t, 1)} }` called with `bar!( { [] [] } )` which will still continue to output `2`.
- Loading branch information
Showing
8 changed files
with
55 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![feature(macro_metavar_expr)] | ||
|
||
macro_rules! foo { | ||
($($t:ident)*) => { ${count(t, 4294967296)} }; | ||
//~^ ERROR related fragment that refers the `count` meta-variable expression was not found | ||
} | ||
|
||
macro_rules! bar { | ||
( $( { $( [ $( ( $( $t:ident )* ) )* ] )* } )* ) => { ${count(t, 4294967296)} } | ||
//~^ ERROR related fragment that refers the `count` meta-variable expression was not found | ||
} | ||
|
||
fn test() { | ||
foo!(); | ||
bar!( { [] [] } ); | ||
} | ||
|
||
fn main() { | ||
} |
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,14 @@ | ||
error: related fragment that refers the `count` meta-variable expression was not found | ||
--> $DIR/issue-111905.rs:4:26 | ||
| | ||
LL | ($($t:ident)*) => { ${count(t, 4294967296)} }; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: related fragment that refers the `count` meta-variable expression was not found | ||
--> $DIR/issue-111905.rs:9:60 | ||
| | ||
LL | ( $( { $( [ $( ( $( $t:ident )* ) )* ] )* } )* ) => { ${count(t, 4294967296)} } | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
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
6 changes: 3 additions & 3 deletions
6
tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.stderr
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