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.stderr | |
| 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.stderr')
| -rw-r--r-- | src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr | 164 |
1 files changed, 91 insertions, 73 deletions
diff --git a/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr b/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr index dc8b7a668c4..0188938a30e 100644 --- a/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr +++ b/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr @@ -1,203 +1,209 @@ error: expected identifier, found `$` - --> $DIR/syntax-errors.rs:16:33 + --> $DIR/syntax-errors.rs:17:33 | LL | ( $( $i:ident ),* ) => { ${ count($i) } }; | ^^^^^ - help: try removing `$` error: expected identifier, found `$` - --> $DIR/syntax-errors.rs:22:26 + --> $DIR/syntax-errors.rs:23:26 | LL | ( $i:ident ) => { ${ count($i) } }; | ^^^^^ - help: try removing `$` error: unexpected token: $ - --> $DIR/syntax-errors.rs:52:8 + --> $DIR/syntax-errors.rs:53:8 | LL | ( $$ $a:ident ) => { | ^ note: `$$` and meta-variable expressions are not allowed inside macro parameter definitions - --> $DIR/syntax-errors.rs:52:8 + --> $DIR/syntax-errors.rs:53:8 | LL | ( $$ $a:ident ) => { | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:59:19 + --> $DIR/syntax-errors.rs:60:19 | LL | ${count() a b c} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:59:19 + --> $DIR/syntax-errors.rs:60:19 | LL | ${count() a b c} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:62:19 + --> $DIR/syntax-errors.rs:63:19 | LL | ${count(i a b c)} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:62:19 + --> $DIR/syntax-errors.rs:63:19 | LL | ${count(i a b c)} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:64:22 + --> $DIR/syntax-errors.rs:65:22 | LL | ${count(i, 1 a b c)} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:64:22 + --> $DIR/syntax-errors.rs:65:22 | LL | ${count(i, 1 a b c)} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:66:20 + --> $DIR/syntax-errors.rs:67:20 | LL | ${count(i) a b c} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:66:20 + --> $DIR/syntax-errors.rs:67:20 | LL | ${count(i) a b c} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:69:21 + --> $DIR/syntax-errors.rs:70:21 | LL | ${ignore(i) a b c} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:69:21 + --> $DIR/syntax-errors.rs:70:21 | LL | ${ignore(i) a b c} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:71:20 + --> $DIR/syntax-errors.rs:72:20 | LL | ${ignore(i a b c)} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:71:20 + --> $DIR/syntax-errors.rs:72:20 | LL | ${ignore(i a b c)} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:74:19 + --> $DIR/syntax-errors.rs:75:19 | LL | ${index() a b c} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:74:19 + --> $DIR/syntax-errors.rs:75:19 | LL | ${index() a b c} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:76:19 + --> $DIR/syntax-errors.rs:77:19 | LL | ${index(1 a b c)} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:76:19 + --> $DIR/syntax-errors.rs:77:19 | LL | ${index(1 a b c)} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:79:19 + --> $DIR/syntax-errors.rs:80:19 | LL | ${index() a b c} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:79:19 + --> $DIR/syntax-errors.rs:80:19 | LL | ${index() a b c} | ^ error: unexpected token: a - --> $DIR/syntax-errors.rs:81:19 + --> $DIR/syntax-errors.rs:82:19 | LL | ${index(1 a b c)} | ^ | note: meta-variable expression must not have trailing tokens - --> $DIR/syntax-errors.rs:81:19 + --> $DIR/syntax-errors.rs:82:19 | LL | ${index(1 a b c)} | ^ error: meta-variable expression depth must be a literal - --> $DIR/syntax-errors.rs:88:33 + --> $DIR/syntax-errors.rs:89:33 | LL | ( $( $i:ident ),* ) => { ${ index(IDX) } }; | ^^^^^ error: unexpected token: { - --> $DIR/syntax-errors.rs:94:8 + --> $DIR/syntax-errors.rs:95:8 | LL | ( ${ length() } ) => { | ^^^^^^^^^^^^ note: `$$` and meta-variable expressions are not allowed inside macro parameter definitions - --> $DIR/syntax-errors.rs:94:8 + --> $DIR/syntax-errors.rs:95:8 | LL | ( ${ length() } ) => { | ^^^^^^^^^^^^ error: expected one of: `*`, `+`, or `?` - --> $DIR/syntax-errors.rs:94:8 + --> $DIR/syntax-errors.rs:95:8 | LL | ( ${ length() } ) => { | ^^^^^^^^^^^^ error: expected identifier - --> $DIR/syntax-errors.rs:101:33 + --> $DIR/syntax-errors.rs:102:33 | LL | ( $( $i:ident ),* ) => { ${ ignore() } }; | ^^^^^^ error: only unsuffixes integer literals are supported in meta-variable expressions - --> $DIR/syntax-errors.rs:107:33 + --> $DIR/syntax-errors.rs:108:33 | LL | ( $( $i:ident ),* ) => { ${ index(1u32) } }; | ^^^^^ error: meta-variable expression parameter must be wrapped in parentheses - --> $DIR/syntax-errors.rs:113:33 + --> $DIR/syntax-errors.rs:114:33 | LL | ( $( $i:ident ),* ) => { ${ count{i} } }; | ^^^^^ error: expected identifier - --> $DIR/syntax-errors.rs:119:31 + --> $DIR/syntax-errors.rs:120:31 | LL | ( $( $i:ident ),* ) => { ${ {} } }; | ^^^^^^ error: unrecognized meta-variable expression - --> $DIR/syntax-errors.rs:125:33 + --> $DIR/syntax-errors.rs:140:33 | LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } }; | ^^^^^^^^^^^^^^ help: supported expressions are count, ignore, index and length +error: `count` can not be placed inside the inner-most repetition + --> $DIR/syntax-errors.rs:12:24 + | +LL | ( $i:ident ) => { ${ count(i) } }; + | ^^^^^^^^^^^^ + error: expected expression, found `$` - --> $DIR/syntax-errors.rs:16:30 + --> $DIR/syntax-errors.rs:17:30 | LL | ( $( $i:ident ),* ) => { ${ count($i) } }; | ^ expected expression @@ -208,7 +214,7 @@ LL | curly__rhs_dollar__round!(a, b, c); = note: this error originates in the macro `curly__rhs_dollar__round` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected expression, found `$` - --> $DIR/syntax-errors.rs:22:23 + --> $DIR/syntax-errors.rs:23:23 | LL | ( $i:ident ) => { ${ count($i) } }; | ^ expected expression @@ -219,13 +225,13 @@ LL | curly__rhs_dollar__no_round!(a); = note: this error originates in the macro `curly__rhs_dollar__no_round` (in Nightly builds, run with -Z macro-backtrace for more info) error: variable 'i' is still repeating at this depth - --> $DIR/syntax-errors.rs:40:36 + --> $DIR/syntax-errors.rs:41:36 | LL | ( $( $i:ident ),* ) => { count($i) }; | ^^ error: expected expression, found `$` - --> $DIR/syntax-errors.rs:59:9 + --> $DIR/syntax-errors.rs:60:9 | LL | ${count() a b c} | ^ expected expression @@ -236,29 +242,18 @@ LL | extra_garbage_after_metavar!(a); = note: this error originates in the macro `extra_garbage_after_metavar` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected expression, found `$` - --> $DIR/syntax-errors.rs:125:30 + --> $DIR/syntax-errors.rs:89:30 | -LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } }; - | ^ expected expression -... -LL | unknown_metavar!(a); - | ------------------- in this macro invocation - | - = note: this error originates in the macro `unknown_metavar` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: expected expression, found `$` - --> $DIR/syntax-errors.rs:113:30 - | -LL | ( $( $i:ident ),* ) => { ${ count{i} } }; +LL | ( $( $i:ident ),* ) => { ${ index(IDX) } }; | ^ expected expression ... -LL | metavar_without_parens!(a); - | -------------------------- in this macro invocation +LL | metavar_depth_is_not_literal!(a); + | -------------------------------- in this macro invocation | - = note: this error originates in the macro `metavar_without_parens` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `metavar_depth_is_not_literal` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected expression, found `$` - --> $DIR/syntax-errors.rs:101:30 + --> $DIR/syntax-errors.rs:102:30 | LL | ( $( $i:ident ),* ) => { ${ ignore() } }; | ^ expected expression @@ -269,40 +264,63 @@ LL | metavar_token_without_ident!(a); = note: this error originates in the macro `metavar_token_without_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected expression, found `$` - --> $DIR/syntax-errors.rs:88:30 + --> $DIR/syntax-errors.rs:108:30 | -LL | ( $( $i:ident ),* ) => { ${ index(IDX) } }; +LL | ( $( $i:ident ),* ) => { ${ index(1u32) } }; | ^ expected expression ... -LL | metavar_depth_is_not_literal!(a); - | -------------------------------- in this macro invocation +LL | metavar_with_literal_suffix!(a); + | ------------------------------- in this macro invocation | - = note: this error originates in the macro `metavar_depth_is_not_literal` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `metavar_with_literal_suffix` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected expression, found `$` - --> $DIR/syntax-errors.rs:107:30 + --> $DIR/syntax-errors.rs:114:30 | -LL | ( $( $i:ident ),* ) => { ${ index(1u32) } }; +LL | ( $( $i:ident ),* ) => { ${ count{i} } }; | ^ expected expression ... -LL | metavar_with_literal_suffix!(a); - | ------------------------------- in this macro invocation +LL | metavar_without_parens!(a); + | -------------------------- in this macro invocation | - = note: this error originates in the macro `metavar_with_literal_suffix` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `metavar_without_parens` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected expression, found `$` - --> $DIR/syntax-errors.rs:119:30 + --> $DIR/syntax-errors.rs:120:30 | LL | ( $( $i:ident ),* ) => { ${ {} } }; | ^ expected expression ... -LL | open_brackets_without_tokens!(a) +LL | open_brackets_without_tokens!(a); | -------------------------------- in this macro invocation | = note: this error originates in the macro `open_brackets_without_tokens` (in Nightly builds, run with -Z macro-backtrace for more info) +error: variable `foo` is not recognized in meta-variable expression + --> $DIR/syntax-errors.rs:127:17 + | +LL | ${count(foo)} + | ^^^ + +error: variable `bar` is not recognized in meta-variable expression + --> $DIR/syntax-errors.rs:134:18 + | +LL | ${ignore(bar)} + | ^^^ + +error: expected expression, found `$` + --> $DIR/syntax-errors.rs:140:30 + | +LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } }; + | ^ expected expression +... +LL | unknown_metavar!(a); + | ------------------- in this macro invocation + | + = note: this error originates in the macro `unknown_metavar` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0425]: cannot find function `count` in this scope - --> $DIR/syntax-errors.rs:28:30 + --> $DIR/syntax-errors.rs:29:30 | LL | ( $( $i:ident ),* ) => { count(i) }; | ^^^^^ not found in this scope @@ -313,7 +331,7 @@ LL | no_curly__no_rhs_dollar__round!(a, b, c); = note: this error originates in the macro `no_curly__no_rhs_dollar__round` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `i` in this scope - --> $DIR/syntax-errors.rs:28:36 + --> $DIR/syntax-errors.rs:29:36 | LL | ( $( $i:ident ),* ) => { count(i) }; | ^ not found in this scope @@ -324,7 +342,7 @@ LL | no_curly__no_rhs_dollar__round!(a, b, c); = note: this error originates in the macro `no_curly__no_rhs_dollar__round` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find function `count` in this scope - --> $DIR/syntax-errors.rs:34:23 + --> $DIR/syntax-errors.rs:35:23 | LL | ( $i:ident ) => { count(i) }; | ^^^^^ not found in this scope @@ -335,7 +353,7 @@ LL | no_curly__no_rhs_dollar__no_round!(a); = note: this error originates in the macro `no_curly__no_rhs_dollar__no_round` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `i` in this scope - --> $DIR/syntax-errors.rs:34:29 + --> $DIR/syntax-errors.rs:35:29 | LL | ( $i:ident ) => { count(i) }; | ^ not found in this scope @@ -346,7 +364,7 @@ LL | no_curly__no_rhs_dollar__no_round!(a); = note: this error originates in the macro `no_curly__no_rhs_dollar__no_round` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find function `count` in this scope - --> $DIR/syntax-errors.rs:45:23 + --> $DIR/syntax-errors.rs:46:23 | LL | ( $i:ident ) => { count($i) }; | ^^^^^ not found in this scope @@ -357,11 +375,11 @@ LL | no_curly__rhs_dollar__no_round!(a); = note: this error originates in the macro `no_curly__rhs_dollar__no_round` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `a` in this scope - --> $DIR/syntax-errors.rs:138:37 + --> $DIR/syntax-errors.rs:153:37 | LL | no_curly__rhs_dollar__no_round!(a); | ^ not found in this scope -error: aborting due to 37 previous errors +error: aborting due to 40 previous errors For more information about this error, try `rustc --explain E0425`. |
