fix tests after s/${length()}/${len()}/

This commit is contained in:
Jubilee Young 2024-05-10 12:12:39 -07:00
parent fa5964fa91
commit 6e74155b0b
11 changed files with 155 additions and 140 deletions

View file

@ -2,8 +2,8 @@
macro_rules! metavar { macro_rules! metavar {
( $i:expr ) => { ( $i:expr ) => {
${length(0)} ${len(0)}
//~^ ERROR meta-variable expression `length` with depth parameter must be called inside of a macro repetition //~^ ERROR meta-variable expression `len` with depth parameter must be called inside of a macro repetition
}; };
} }

View file

@ -1,8 +1,8 @@
error: meta-variable expression `length` with depth parameter must be called inside of a macro repetition error: meta-variable expression `len` with depth parameter must be called inside of a macro repetition
--> $DIR/meta-variable-depth-outside-repeat.rs:5:10 --> $DIR/meta-variable-depth-outside-repeat.rs:5:10
| |
LL | ${length(0)} LL | ${len(0)}
| ^^^^^^^^^^^ | ^^^^^^^^
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -3,60 +3,55 @@
#![feature(macro_metavar_expr)] #![feature(macro_metavar_expr)]
fn main() { fn main() {
macro_rules! one_nested_count_and_length { macro_rules! one_nested_count_and_len {
( $( [ $( $l:literal ),* ] ),* ) => { ( $( [ $( $l:literal ),* ] ),* ) => {
[ [
// outer-most repetition // outer-most repetition
$( $(
// inner-most repetition // inner-most repetition
$( $(
${ignore($l)} ${index()}, ${length()}, ${ignore($l)} ${index()}, ${len()},
)* )*
${count($l)}, ${index()}, ${length()}, ${count($l)}, ${index()}, ${len()},
)* )*
${count($l)}, ${count($l)},
] ]
}; };
} }
assert_eq!( assert_eq!(
one_nested_count_and_length!(["foo"], ["bar", "baz"]), one_nested_count_and_len!(["foo"], ["bar", "baz"]),
[ [
// # ["foo"] // # ["foo"]
// ## inner-most repetition (first iteration) // ## inner-most repetition (first iteration)
// //
// `index` is 0 because this is the first inner-most iteration. // `index` is 0 because this is the first inner-most iteration.
// `length` is 1 because there is only one inner-most repetition, "foo". // `len` is 1 because there is only one inner-most repetition, "foo".
0, 1, 0, 1,
// ## outer-most repetition (first iteration) // ## outer-most repetition (first iteration)
// //
// `count` is 1 because of "foo", i,e, `$l` has only one repetition, // `count` is 1 because of "foo", i,e, `$l` has only one repetition,
// `index` is 0 because this is the first outer-most iteration. // `index` is 0 because this is the first outer-most iteration.
// `length` is 2 because there are 2 outer-most repetitions, ["foo"] and ["bar", "baz"] // `len` is 2 because there are 2 outer-most repetitions, ["foo"] and ["bar", "baz"]
1, 0, 2, 1, 0, 2,
// # ["bar", "baz"] // # ["bar", "baz"]
// ## inner-most repetition (first iteration) // ## inner-most repetition (first iteration)
// //
// `index` is 0 because this is the first inner-most iteration // `index` is 0 because this is the first inner-most iteration
// `length` is 2 because there are repetitions, "bar" and "baz" // `len` is 2 because there are repetitions, "bar" and "baz"
0, 2, 0, 2,
// ## inner-most repetition (second iteration) // ## inner-most repetition (second iteration)
// //
// `index` is 1 because this is the second inner-most iteration // `index` is 1 because this is the second inner-most iteration
// `length` is 2 because there are repetitions, "bar" and "baz" // `len` is 2 because there are repetitions, "bar" and "baz"
1, 2, 1, 2,
// ## outer-most repetition (second iteration) // ## outer-most repetition (second iteration)
// //
// `count` is 2 because of "bar" and "baz", i,e, `$l` has two repetitions, // `count` is 2 because of "bar" and "baz", i,e, `$l` has two repetitions,
// `index` is 1 because this is the second outer-most iteration // `index` is 1 because this is the second outer-most iteration
// `length` is 2 because there are 2 outer-most repetitions, ["foo"] and ["bar", "baz"] // `len` is 2 because there are 2 outer-most repetitions, ["foo"] and ["bar", "baz"]
2, 1, 2, 2, 1, 2,
// # last count // # last count
// Because there are a total of 3 repetitions of `$l`, "foo", "bar" and "baz" // Because there are a total of 3 repetitions of `$l`, "foo", "bar" and "baz"
@ -131,7 +126,6 @@ macro_rules! three_nested_count {
&[2][..], &[2][..],
// t u v w x y z // t u v w x y z
&[7][..], &[7][..],
// (a b c) (d e f) // (a b c) (d e f)
&[6, 2][..], &[6, 2][..],
// (g h) (i j k l m) // (g h) (i j k l m)
@ -142,7 +136,6 @@ macro_rules! three_nested_count {
&[5, 3][..], &[5, 3][..],
// (t u v w x y z) // (t u v w x y z)
&[7, 1][..], &[7, 1][..],
// [ (a b c) (d e f) ] // [ (a b c) (d e f) ]
// [ (g h) (i j k l m) ] // [ (g h) (i j k l m) ]
// [ (n) ] // [ (n) ]
@ -150,7 +143,6 @@ macro_rules! three_nested_count {
// [ (o) (p q) (r s) ] // [ (o) (p q) (r s) ]
// [ (t u v w x y z) ] // [ (t u v w x y z) ]
&[12, 4, 2][..], &[12, 4, 2][..],
// { // {
// [ (a b c) (d e f) ] // [ (a b c) (d e f) ]
// [ (g h) (i j k l m) ] // [ (g h) (i j k l m) ]
@ -165,43 +157,43 @@ macro_rules! three_nested_count {
); );
// Grouped from the outer-most to the inner-most // Grouped from the outer-most to the inner-most
macro_rules! three_nested_length { macro_rules! three_nested_len {
( $( { $( [ $( ( $( $i:ident )* ) )* ] )* } )* ) => { ( $( { $( [ $( ( $( $i:ident )* ) )* ] )* } )* ) => {
&[ &[
$( $( $( $( $( $( $( $(
&[ &[
${ignore($i)} ${length(3)}, ${ignore($i)} ${len(3)},
${ignore($i)} ${length(2)}, ${ignore($i)} ${len(2)},
${ignore($i)} ${length(1)}, ${ignore($i)} ${len(1)},
${ignore($i)} ${length(0)}, ${ignore($i)} ${len(0)},
][..], ][..],
)* )* )* )* )* )* )* )*
$( $( $( $( $( $(
&[ &[
${ignore($i)} ${length(2)}, ${ignore($i)} ${len(2)},
${ignore($i)} ${length(1)}, ${ignore($i)} ${len(1)},
${ignore($i)} ${length(0)}, ${ignore($i)} ${len(0)},
][..], ][..],
)* )* )* )* )* )*
$( $( $( $(
&[ &[
${ignore($i)} ${length(1)}, ${ignore($i)} ${len(1)},
${ignore($i)} ${length(0)}, ${ignore($i)} ${len(0)},
][..], ][..],
)* )* )* )*
$( $(
&[ &[
${ignore($i)} ${length(0)}, ${ignore($i)} ${len(0)},
][..], ][..],
)* )*
][..] ][..]
} }
} }
assert_eq!( assert_eq!(
three_nested_length!( three_nested_len!(
{ {
[ (a b c) (d e f) ] [ (a b c) (d e f) ]
[ (g h) (i j k l m) ] [ (g h) (i j k l m) ]
@ -214,45 +206,64 @@ macro_rules! three_nested_length {
), ),
&[ &[
// a b c // a b c
&[2, 3, 2, 3][..], &[2, 3, 2, 3][..], &[2, 3, 2, 3][..], &[2, 3, 2, 3][..],
&[2, 3, 2, 3][..],
&[2, 3, 2, 3][..],
// d e f // d e f
&[2, 3, 2, 3][..], &[2, 3, 2, 3][..], &[2, 3, 2, 3][..], &[2, 3, 2, 3][..],
&[2, 3, 2, 3][..],
&[2, 3, 2, 3][..],
// g h // g h
&[2, 3, 2, 2][..], &[2, 3, 2, 2][..], &[2, 3, 2, 2][..],
&[2, 3, 2, 2][..],
// i j k l m // i j k l m
&[2, 3, 2, 5][..], &[2, 3, 2, 5][..], &[2, 3, 2, 5][..], &[2, 3, 2, 5][..], &[2, 3, 2, 5][..],
&[2, 3, 2, 5][..],
&[2, 3, 2, 5][..],
&[2, 3, 2, 5][..],
&[2, 3, 2, 5][..], &[2, 3, 2, 5][..],
// n // n
&[2, 3, 1, 1][..], &[2, 3, 1, 1][..],
// o // o
&[2, 2, 3, 1][..], &[2, 2, 3, 1][..],
// p q // p q
&[2, 2, 3, 2][..], &[2, 2, 3, 2][..], &[2, 2, 3, 2][..],
&[2, 2, 3, 2][..],
// r s // r s
&[2, 2, 3, 2][..], &[2, 2, 3, 2][..], &[2, 2, 3, 2][..],
&[2, 2, 3, 2][..],
// t u v w x y z // t u v w x y z
&[2, 2, 1, 7][..], &[2, 2, 1, 7][..], &[2, 2, 1, 7][..], &[2, 2, 1, 7][..], &[2, 2, 1, 7][..],
&[2, 2, 1, 7][..], &[2, 2, 1, 7][..], &[2, 2, 1, 7][..], &[2, 2, 1, 7][..],
&[2, 2, 1, 7][..],
&[2, 2, 1, 7][..],
&[2, 2, 1, 7][..],
&[2, 2, 1, 7][..],
&[2, 2, 1, 7][..],
// (a b c) (d e f) // (a b c) (d e f)
&[2, 3, 2][..], &[2, 3, 2][..], &[2, 3, 2][..],
&[2, 3, 2][..],
// (g h) (i j k l m) // (g h) (i j k l m)
&[2, 3, 2][..], &[2, 3, 2][..], &[2, 3, 2][..],
&[2, 3, 2][..],
// (n) // (n)
&[2, 3, 1][..], &[2, 3, 1][..],
// (o) (p q) (r s) // (o) (p q) (r s)
&[2, 2, 3][..], &[2, 2, 3][..], &[2, 2, 3][..], &[2, 2, 3][..],
&[2, 2, 3][..],
&[2, 2, 3][..],
// (t u v w x y z) // (t u v w x y z)
&[2, 2, 1][..], &[2, 2, 1][..],
// [ (a b c) (d e f) ] // [ (a b c) (d e f) ]
// [ (g h) (i j k l m) ] // [ (g h) (i j k l m) ]
// [ (n) ] // [ (n) ]
&[2, 3][..], &[2, 3][..], &[2, 3,][..], &[2, 3][..],
&[2, 3][..],
&[2, 3,][..],
// [ (o) (p q) (r s) ] // [ (o) (p q) (r s) ]
// [ (t u v w x y z) ] // [ (t u v w x y z) ]
&[2, 2][..], &[2, 2][..], &[2, 2][..],
&[2, 2][..],
// { // {
// [ (a b c) (d e f) ] // [ (a b c) (d e f) ]
// [ (g h) (i j k l m) ] // [ (g h) (i j k l m) ]
@ -262,10 +273,11 @@ macro_rules! three_nested_length {
// [ (o) (p q) (r s) ] // [ (o) (p q) (r s) ]
// [ (t u v w x y z) ] // [ (t u v w x y z) ]
// } // }
&[2][..], &[2][..] &[2][..],
&[2][..]
][..] ][..]
); );
// It is possible to say, to some degree, that count is an "amalgamation" of length (see // It is possible to say, to some degree, that count is an "amalgamation" of len (see
// each length line result and compare them with the count results) // each len line result and compare them with the count results)
} }

View file

@ -37,17 +37,17 @@ macro_rules! count_depth_limits {
}; };
} }
/// Produce (index, length) pairs for literals in a macro repetition. /// Produce (index, len) pairs for literals in a macro repetition.
/// The literal is not included in the output, so this macro uses the /// The literal is not included in the output, so this macro uses the
/// `ignore` meta-variable expression to create a non-expanding /// `ignore` meta-variable expression to create a non-expanding
/// repetition binding. /// repetition binding.
macro_rules! enumerate_literals { macro_rules! enumerate_literals {
( $( ($l:stmt) ),* ) => { ( $( ($l:stmt) ),* ) => {
[$( ${ignore($l)} (${index()}, ${length()}) ),*] [$( ${ignore($l)} (${index()}, ${len()}) ),*]
}; };
} }
/// Produce index and length tuples for literals in a 2-dimensional /// Produce index and len tuples for literals in a 2-dimensional
/// macro repetition. /// macro repetition.
macro_rules! enumerate_literals_2 { macro_rules! enumerate_literals_2 {
( $( [ $( ($l:literal) ),* ] ),* ) => { ( $( [ $( ($l:literal) ),* ] ),* ) => {
@ -56,9 +56,9 @@ macro_rules! enumerate_literals_2 {
$( $(
( (
${index(1)}, ${index(1)},
${length(1)}, ${len(1)},
${index(0)}, ${index(0)},
${length(0)}, ${len(0)},
$l $l
), ),
)* )*
@ -134,7 +134,6 @@ fn main() {
(0, 2, 0, 3, "foo"), (0, 2, 0, 3, "foo"),
(0, 2, 1, 3, "bar"), (0, 2, 1, 3, "bar"),
(0, 2, 2, 3, "baz"), (0, 2, 2, 3, "baz"),
(1, 2, 0, 4, "qux"), (1, 2, 0, 4, "qux"),
(1, 2, 1, 4, "quux"), (1, 2, 1, 4, "quux"),
(1, 2, 2, 4, "quuz"), (1, 2, 2, 4, "quuz"),

View file

@ -17,20 +17,20 @@ macro_rules! example {
_nested: vec![ _nested: vec![
$( $(
Example { Example {
_indexes: &[(${index()}, ${length()})], _indexes: &[(${index()}, ${len()})],
_counts: &[${count($x, 0)}, ${count($x, 1)}], _counts: &[${count($x, 0)}, ${count($x, 1)}],
_nested: vec![ _nested: vec![
$( $(
Example { Example {
_indexes: &[(${index(1)}, ${length(1)}), (${index()}, ${length()})], _indexes: &[(${index(1)}, ${len(1)}), (${index()}, ${len()})],
_counts: &[${count($x)}], _counts: &[${count($x)}],
_nested: vec![ _nested: vec![
$( $(
Example { Example {
_indexes: &[ _indexes: &[
(${index(2)}, ${length(2)}), (${index(2)}, ${len(2)}),
(${index(1)}, ${length(1)}), (${index(1)}, ${len(1)}),
(${index()}, ${length()}) (${index()}, ${len()})
], ],
_counts: &[], _counts: &[],
_nested: vec![], _nested: vec![],

View file

@ -28,9 +28,9 @@ macro_rules! c {
( (
$( $( $( $(
${ignore($foo)} ${ignore($foo)}
${length(0)} ${len(0)}
${length(10)} ${len(10)}
//~^ ERROR depth parameter of meta-variable expression `length` must be less than 2 //~^ ERROR depth parameter of meta-variable expression `len` must be less than 2
)* )* )* )*
) )
}; };

View file

@ -10,11 +10,11 @@ error: depth parameter of meta-variable expression `index` must be less than 3
LL | ${index(10)}, LL | ${index(10)},
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: depth parameter of meta-variable expression `length` must be less than 2 error: depth parameter of meta-variable expression `len` must be less than 2
--> $DIR/out-of-bounds-arguments.rs:32:18 --> $DIR/out-of-bounds-arguments.rs:32:18
| |
LL | ${length(10)} LL | ${len(10)}
| ^^^^^^^^^^^^ | ^^^^^^^^^
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -32,13 +32,12 @@ macro_rules! ignore {
}}; }};
} }
macro_rules! length { macro_rules! len {
( $( $e:stmt ),* ) => { ( $( $e:stmt ),* ) => {
$( ${ignore($e)} ${length()} )* $( ${ignore($e)} ${len()} )*
//~^ ERROR meta-variable expressions are unstable //~^ ERROR meta-variable expressions are unstable
//~| ERROR meta-variable expressions are unstable //~| ERROR meta-variable expressions are unstable
}; };
} }
fn main() { fn main() {}
}

View file

@ -81,7 +81,7 @@ LL | 0 $( + 1 ${ignore($i)} )*
error[E0658]: meta-variable expressions are unstable error[E0658]: meta-variable expressions are unstable
--> $DIR/required-feature.rs:37:13 --> $DIR/required-feature.rs:37:13
| |
LL | $( ${ignore($e)} ${length()} )* LL | $( ${ignore($e)} ${len()} )*
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information = note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
@ -91,8 +91,8 @@ LL | $( ${ignore($e)} ${length()} )*
error[E0658]: meta-variable expressions are unstable error[E0658]: meta-variable expressions are unstable
--> $DIR/required-feature.rs:37:27 --> $DIR/required-feature.rs:37:27
| |
LL | $( ${ignore($e)} ${length()} )* LL | $( ${ignore($e)} ${len()} )*
| ^^^^^^^^^^ | ^^^^^^^
| |
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information = note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable = help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable

View file

@ -18,23 +18,27 @@ macro_rules! curly__rhs_dollar__no_round {
//~^ ERROR `count` can not be placed inside the inner-most repetition //~^ ERROR `count` can not be placed inside the inner-most repetition
} }
#[rustfmt::skip] // autoformatters can break a few of the error traces
macro_rules! no_curly__no_rhs_dollar__round { macro_rules! no_curly__no_rhs_dollar__round {
( $( $i:ident ),* ) => { count(i) }; ( $( $i:ident ),* ) => { count(i) };
//~^ ERROR cannot find function `count` in this scope //~^ ERROR cannot find function `count` in this scope
//~| ERROR cannot find value `i` in this scope //~| ERROR cannot find value `i` in this scope
} }
#[rustfmt::skip] // autoformatters can break a few of the error traces
macro_rules! no_curly__no_rhs_dollar__no_round { macro_rules! no_curly__no_rhs_dollar__no_round {
( $i:ident ) => { count(i) }; ( $i:ident ) => { count(i) };
//~^ ERROR cannot find function `count` in this scope //~^ ERROR cannot find function `count` in this scope
//~| ERROR cannot find value `i` in this scope //~| ERROR cannot find value `i` in this scope
} }
#[rustfmt::skip] // autoformatters can break a few of the error traces
macro_rules! no_curly__rhs_dollar__round { macro_rules! no_curly__rhs_dollar__round {
( $( $i:ident ),* ) => { count($i) }; ( $( $i:ident ),* ) => { count($i) };
//~^ ERROR variable 'i' is still repeating at this depth //~^ ERROR variable 'i' is still repeating at this depth
} }
#[rustfmt::skip] // autoformatters can break a few of the error traces
macro_rules! no_curly__rhs_dollar__no_round { macro_rules! no_curly__rhs_dollar__no_round {
( $i:ident ) => { count($i) }; ( $i:ident ) => { count($i) };
//~^ ERROR cannot find function `count` in this scope //~^ ERROR cannot find function `count` in this scope
@ -44,7 +48,7 @@ macro_rules! no_curly__rhs_dollar__no_round {
macro_rules! dollar_dollar_in_the_lhs { macro_rules! dollar_dollar_in_the_lhs {
( $$ $a:ident ) => { ( $$ $a:ident ) => {
//~^ ERROR unexpected token: $ //~^ ERROR unexpected token: $
}; };
} }
@ -85,7 +89,7 @@ macro_rules! metavar_depth_is_not_literal {
} }
macro_rules! metavar_in_the_lhs { macro_rules! metavar_in_the_lhs {
( ${ length() } ) => { ( ${ len() } ) => {
//~^ ERROR unexpected token: { //~^ ERROR unexpected token: {
//~| ERROR expected one of: `*`, `+`, or `?` //~| ERROR expected one of: `*`, `+`, or `?`
}; };
@ -109,6 +113,7 @@ macro_rules! metavar_without_parens {
//~| ERROR expected expression, found `$` //~| ERROR expected expression, found `$`
} }
#[rustfmt::skip]
macro_rules! open_brackets_without_tokens { macro_rules! open_brackets_without_tokens {
( $( $i:ident ),* ) => { ${ {} } }; ( $( $i:ident ),* ) => { ${ {} } };
//~^ ERROR expected expression, found `$` //~^ ERROR expected expression, found `$`

View file

@ -1,200 +1,200 @@
error: unexpected token: $ error: unexpected token: $
--> $DIR/syntax-errors.rs:46:8 --> $DIR/syntax-errors.rs:50:8
| |
LL | ( $$ $a:ident ) => { LL | ( $$ $a:ident ) => {
| ^ | ^
note: `$$` and meta-variable expressions are not allowed inside macro parameter definitions note: `$$` and meta-variable expressions are not allowed inside macro parameter definitions
--> $DIR/syntax-errors.rs:46:8 --> $DIR/syntax-errors.rs:50:8
| |
LL | ( $$ $a:ident ) => { LL | ( $$ $a:ident ) => {
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:53:19 --> $DIR/syntax-errors.rs:57:19
| |
LL | ${count() a b c} LL | ${count() a b c}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:53:19 --> $DIR/syntax-errors.rs:57:19
| |
LL | ${count() a b c} LL | ${count() a b c}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:56:20 --> $DIR/syntax-errors.rs:60:20
| |
LL | ${count($i a b c)} LL | ${count($i a b c)}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:56:20 --> $DIR/syntax-errors.rs:60:20
| |
LL | ${count($i a b c)} LL | ${count($i a b c)}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:58:23 --> $DIR/syntax-errors.rs:62:23
| |
LL | ${count($i, 1 a b c)} LL | ${count($i, 1 a b c)}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:58:23 --> $DIR/syntax-errors.rs:62:23
| |
LL | ${count($i, 1 a b c)} LL | ${count($i, 1 a b c)}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:60:21 --> $DIR/syntax-errors.rs:64:21
| |
LL | ${count($i) a b c} LL | ${count($i) a b c}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:60:21 --> $DIR/syntax-errors.rs:64:21
| |
LL | ${count($i) a b c} LL | ${count($i) a b c}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:63:22 --> $DIR/syntax-errors.rs:67:22
| |
LL | ${ignore($i) a b c} LL | ${ignore($i) a b c}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:63:22 --> $DIR/syntax-errors.rs:67:22
| |
LL | ${ignore($i) a b c} LL | ${ignore($i) a b c}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:65:21 --> $DIR/syntax-errors.rs:69:21
| |
LL | ${ignore($i a b c)} LL | ${ignore($i a b c)}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:65:21 --> $DIR/syntax-errors.rs:69:21
| |
LL | ${ignore($i a b c)} LL | ${ignore($i a b c)}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:68:19 --> $DIR/syntax-errors.rs:72:19
| |
LL | ${index() a b c} LL | ${index() a b c}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:68:19 --> $DIR/syntax-errors.rs:72:19
| |
LL | ${index() a b c} LL | ${index() a b c}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:70:19 --> $DIR/syntax-errors.rs:74:19
| |
LL | ${index(1 a b c)} LL | ${index(1 a b c)}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:70:19 --> $DIR/syntax-errors.rs:74:19
| |
LL | ${index(1 a b c)} LL | ${index(1 a b c)}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:73:19 --> $DIR/syntax-errors.rs:77:19
| |
LL | ${index() a b c} LL | ${index() a b c}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:73:19 --> $DIR/syntax-errors.rs:77:19
| |
LL | ${index() a b c} LL | ${index() a b c}
| ^ | ^
error: unexpected token: a error: unexpected token: a
--> $DIR/syntax-errors.rs:75:19 --> $DIR/syntax-errors.rs:79:19
| |
LL | ${index(1 a b c)} LL | ${index(1 a b c)}
| ^ | ^
| |
note: meta-variable expression must not have trailing tokens note: meta-variable expression must not have trailing tokens
--> $DIR/syntax-errors.rs:75:19 --> $DIR/syntax-errors.rs:79:19
| |
LL | ${index(1 a b c)} LL | ${index(1 a b c)}
| ^ | ^
error: meta-variable expression depth must be a literal error: meta-variable expression depth must be a literal
--> $DIR/syntax-errors.rs:82:33 --> $DIR/syntax-errors.rs:86:33
| |
LL | ( $( $i:ident ),* ) => { ${ index(IDX) } }; LL | ( $( $i:ident ),* ) => { ${ index(IDX) } };
| ^^^^^ | ^^^^^
error: unexpected token: { error: unexpected token: {
--> $DIR/syntax-errors.rs:88:8 --> $DIR/syntax-errors.rs:92:8
| |
LL | ( ${ length() } ) => { LL | ( ${ len() } ) => {
| ^^^^^^^^^^^^ | ^^^^^^^^^
note: `$$` and meta-variable expressions are not allowed inside macro parameter definitions note: `$$` and meta-variable expressions are not allowed inside macro parameter definitions
--> $DIR/syntax-errors.rs:88:8 --> $DIR/syntax-errors.rs:92:8
| |
LL | ( ${ length() } ) => { LL | ( ${ len() } ) => {
| ^^^^^^^^^^^^ | ^^^^^^^^^
error: expected one of: `*`, `+`, or `?` error: expected one of: `*`, `+`, or `?`
--> $DIR/syntax-errors.rs:88:8 --> $DIR/syntax-errors.rs:92:8
| |
LL | ( ${ length() } ) => { LL | ( ${ len() } ) => {
| ^^^^^^^^^^^^ | ^^^^^^^^^
error: meta-variables within meta-variable expressions must be referenced using a dollar sign error: meta-variables within meta-variable expressions must be referenced using a dollar sign
--> $DIR/syntax-errors.rs:95:33 --> $DIR/syntax-errors.rs:99:33
| |
LL | ( $( $i:ident ),* ) => { ${ ignore() } }; LL | ( $( $i:ident ),* ) => { ${ ignore() } };
| ^^^^^^ | ^^^^^^
error: only unsuffixes integer literals are supported in meta-variable expressions error: only unsuffixes integer literals are supported in meta-variable expressions
--> $DIR/syntax-errors.rs:101:33 --> $DIR/syntax-errors.rs:105:33
| |
LL | ( $( $i:ident ),* ) => { ${ index(1u32) } }; LL | ( $( $i:ident ),* ) => { ${ index(1u32) } };
| ^^^^^ | ^^^^^
error: meta-variable expression parameter must be wrapped in parentheses error: meta-variable expression parameter must be wrapped in parentheses
--> $DIR/syntax-errors.rs:107:33 --> $DIR/syntax-errors.rs:111:33
| |
LL | ( $( $i:ident ),* ) => { ${ count{i} } }; LL | ( $( $i:ident ),* ) => { ${ count{i} } };
| ^^^^^ | ^^^^^
error: expected identifier
--> $DIR/syntax-errors.rs:113:31
|
LL | ( $( $i:ident ),* ) => { ${ {} } };
| ^^^^^^
error: meta-variables within meta-variable expressions must be referenced using a dollar sign error: meta-variables within meta-variable expressions must be referenced using a dollar sign
--> $DIR/syntax-errors.rs:120:11 --> $DIR/syntax-errors.rs:125:11
| |
LL | ${count(foo)} LL | ${count(foo)}
| ^^^^^ | ^^^^^
error: meta-variables within meta-variable expressions must be referenced using a dollar sign error: meta-variables within meta-variable expressions must be referenced using a dollar sign
--> $DIR/syntax-errors.rs:128:11 --> $DIR/syntax-errors.rs:133:11
| |
LL | ${ignore(bar)} LL | ${ignore(bar)}
| ^^^^^^ | ^^^^^^
error: unrecognized meta-variable expression error: unrecognized meta-variable expression
--> $DIR/syntax-errors.rs:135:33 --> $DIR/syntax-errors.rs:140:33
| |
LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } }; LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } };
| ^^^^^^^^^^^^^^ help: supported expressions are count, ignore, index and length | ^^^^^^^^^^^^^^ help: supported expressions are count, ignore, index and len
error: expected identifier
--> $DIR/syntax-errors.rs:118:31
|
LL | ( $( $i:ident ),* ) => { ${ {} } };
| ^^^^^^
error: `count` can not be placed inside the inner-most repetition error: `count` can not be placed inside the inner-most repetition
--> $DIR/syntax-errors.rs:12:24 --> $DIR/syntax-errors.rs:12:24
@ -209,13 +209,13 @@ LL | ( $i:ident ) => { ${ count($i) } };
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: variable 'i' is still repeating at this depth error: variable 'i' is still repeating at this depth
--> $DIR/syntax-errors.rs:34:36 --> $DIR/syntax-errors.rs:37:36
| |
LL | ( $( $i:ident ),* ) => { count($i) }; LL | ( $( $i:ident ),* ) => { count($i) };
| ^^ | ^^
error: expected expression, found `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:53:9 --> $DIR/syntax-errors.rs:57:9
| |
LL | ${count() a b c} LL | ${count() a b c}
| ^ expected expression | ^ expected expression
@ -226,7 +226,7 @@ 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) = 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 `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:82:30 --> $DIR/syntax-errors.rs:86:30
| |
LL | ( $( $i:ident ),* ) => { ${ index(IDX) } }; LL | ( $( $i:ident ),* ) => { ${ index(IDX) } };
| ^ expected expression | ^ expected expression
@ -237,7 +237,7 @@ LL | metavar_depth_is_not_literal!(a);
= 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_depth_is_not_literal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:95:30 --> $DIR/syntax-errors.rs:99:30
| |
LL | ( $( $i:ident ),* ) => { ${ ignore() } }; LL | ( $( $i:ident ),* ) => { ${ ignore() } };
| ^ expected expression | ^ expected expression
@ -248,7 +248,7 @@ 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) = 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 `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:101:30 --> $DIR/syntax-errors.rs:105:30
| |
LL | ( $( $i:ident ),* ) => { ${ index(1u32) } }; LL | ( $( $i:ident ),* ) => { ${ index(1u32) } };
| ^ expected expression | ^ expected expression
@ -259,7 +259,7 @@ LL | metavar_with_literal_suffix!(a);
= 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_with_literal_suffix` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:107:30 --> $DIR/syntax-errors.rs:111:30
| |
LL | ( $( $i:ident ),* ) => { ${ count{i} } }; LL | ( $( $i:ident ),* ) => { ${ count{i} } };
| ^ expected expression | ^ expected expression
@ -270,7 +270,7 @@ LL | metavar_without_parens!(a);
= 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_without_parens` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:113:30 --> $DIR/syntax-errors.rs:118:30
| |
LL | ( $( $i:ident ),* ) => { ${ {} } }; LL | ( $( $i:ident ),* ) => { ${ {} } };
| ^ expected expression | ^ expected expression
@ -281,7 +281,7 @@ LL | open_brackets_without_tokens!(a);
= note: this error originates in the macro `open_brackets_without_tokens` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `open_brackets_without_tokens` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:120:9 --> $DIR/syntax-errors.rs:125:9
| |
LL | ${count(foo)} LL | ${count(foo)}
| ^ expected expression | ^ expected expression
@ -292,7 +292,7 @@ LL | unknown_count_ident!(a);
= note: this error originates in the macro `unknown_count_ident` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unknown_count_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:128:9 --> $DIR/syntax-errors.rs:133:9
| |
LL | ${ignore(bar)} LL | ${ignore(bar)}
| ^ expected expression | ^ expected expression
@ -303,7 +303,7 @@ LL | unknown_ignore_ident!(a);
= note: this error originates in the macro `unknown_ignore_ident` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unknown_ignore_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found `$` error: expected expression, found `$`
--> $DIR/syntax-errors.rs:135:30 --> $DIR/syntax-errors.rs:140:30
| |
LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } }; LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } };
| ^ expected expression | ^ expected expression
@ -314,7 +314,7 @@ LL | unknown_metavar!(a);
= note: this error originates in the macro `unknown_metavar` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unknown_metavar` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `i` in this scope error[E0425]: cannot find value `i` in this scope
--> $DIR/syntax-errors.rs:22:36 --> $DIR/syntax-errors.rs:23:36
| |
LL | ( $( $i:ident ),* ) => { count(i) }; LL | ( $( $i:ident ),* ) => { count(i) };
| ^ not found in this scope | ^ not found in this scope
@ -325,7 +325,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) = 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 error[E0425]: cannot find value `i` in this scope
--> $DIR/syntax-errors.rs:28:29 --> $DIR/syntax-errors.rs:30:29
| |
LL | ( $i:ident ) => { count(i) }; LL | ( $i:ident ) => { count(i) };
| ^ not found in this scope | ^ not found in this scope
@ -336,13 +336,13 @@ 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) = 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 `a` in this scope error[E0425]: cannot find value `a` in this scope
--> $DIR/syntax-errors.rs:147:37 --> $DIR/syntax-errors.rs:152:37
| |
LL | no_curly__rhs_dollar__no_round!(a); LL | no_curly__rhs_dollar__no_round!(a);
| ^ not found in this scope | ^ not found in this scope
error[E0425]: cannot find function `count` in this scope error[E0425]: cannot find function `count` in this scope
--> $DIR/syntax-errors.rs:22:30 --> $DIR/syntax-errors.rs:23:30
| |
LL | ( $( $i:ident ),* ) => { count(i) }; LL | ( $( $i:ident ),* ) => { count(i) };
| ^^^^^ not found in this scope | ^^^^^ not found in this scope
@ -353,7 +353,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) = 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 error[E0425]: cannot find function `count` in this scope
--> $DIR/syntax-errors.rs:28:23 --> $DIR/syntax-errors.rs:30:23
| |
LL | ( $i:ident ) => { count(i) }; LL | ( $i:ident ) => { count(i) };
| ^^^^^ not found in this scope | ^^^^^ not found in this scope
@ -364,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) = 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 error[E0425]: cannot find function `count` in this scope
--> $DIR/syntax-errors.rs:39:23 --> $DIR/syntax-errors.rs:43:23
| |
LL | ( $i:ident ) => { count($i) }; LL | ( $i:ident ) => { count($i) };
| ^^^^^ not found in this scope | ^^^^^ not found in this scope