diff options
| author | Caio <c410.f3r@gmail.com> | 2022-03-11 17:48:51 -0300 |
|---|---|---|
| committer | Caio <c410.f3r@gmail.com> | 2022-03-11 17:48:51 -0300 |
| commit | d0eca08bc4acbccd5125d245788979cc933bdf0f (patch) | |
| tree | 3103d1a8da266a5bcda4b67d69e74928976a10e5 /src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs | |
| parent | 8756ed20b28d87d63378f08790b82d69490e6eb6 (diff) | |
| download | rust-d0eca08bc4acbccd5125d245788979cc933bdf0f.tar.gz rust-d0eca08bc4acbccd5125d245788979cc933bdf0f.zip | |
Implement macro meta-variable expression
Diffstat (limited to 'src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs')
| -rw-r--r-- | src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs b/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs index ea73fd0813c..fdf16442d2a 100644 --- a/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs +++ b/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs @@ -10,6 +10,7 @@ macro_rules! curly__no_rhs_dollar__round { macro_rules! curly__no_rhs_dollar__no_round { ( $i:ident ) => { ${ count(i) } }; + //~^ ERROR `count` can not be placed inside the inner-most repetition } macro_rules! curly__rhs_dollar__round { @@ -121,6 +122,20 @@ macro_rules! open_brackets_without_tokens { //~| ERROR expected identifier } +macro_rules! unknown_count_ident { + ( $( $i:ident )* ) => { + ${count(foo)} + //~^ ERROR variable `foo` is not recognized in meta-variable expression + }; +} + +macro_rules! unknown_ignore_ident { + ( $( $i:ident )* ) => { + ${ignore(bar)} + //~^ ERROR variable `bar` is not recognized in meta-variable expression + }; +} + macro_rules! unknown_metavar { ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } }; //~^ ERROR unrecognized meta-variable expression @@ -139,10 +154,12 @@ fn main() { //~^ ERROR cannot find value `a` in this scope extra_garbage_after_metavar!(a); - unknown_metavar!(a); - metavar_without_parens!(a); - metavar_token_without_ident!(a); metavar_depth_is_not_literal!(a); + metavar_token_without_ident!(a); metavar_with_literal_suffix!(a); - open_brackets_without_tokens!(a) + metavar_without_parens!(a); + open_brackets_without_tokens!(a); + unknown_count_ident!(a); + unknown_ignore_ident!(a); + unknown_metavar!(a); } |
