summaryrefslogtreecommitdiffstats
path: root/tests/ui/macros/rfc-3086-metavar-expr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /tests/ui/macros/rfc-3086-metavar-expr
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/macros/rfc-3086-metavar-expr')
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/count-and-length-are-distinct.rs60
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs28
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs2
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr4
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/macro-expansion.rs14
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.rs14
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.stderr10
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/required-feature.rs8
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/required-feature.stderr28
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs34
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr206
11 files changed, 198 insertions, 210 deletions
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/count-and-length-are-distinct.rs b/tests/ui/macros/rfc-3086-metavar-expr/count-and-length-are-distinct.rs
index ab8d95a41..1b8ce10cc 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/count-and-length-are-distinct.rs
+++ b/tests/ui/macros/rfc-3086-metavar-expr/count-and-length-are-distinct.rs
@@ -10,11 +10,11 @@ fn main() {
$(
// inner-most repetition
$(
- ${ignore(l)} ${index()}, ${length()},
+ ${ignore($l)} ${index()}, ${length()},
)*
- ${count(l)}, ${index()}, ${length()},
+ ${count($l)}, ${index()}, ${length()},
)*
- ${count(l)},
+ ${count($l)},
]
};
}
@@ -72,30 +72,30 @@ fn main() {
&[
$( $( $(
&[
- ${ignore(i)} ${count(i, 0)},
+ ${ignore($i)} ${count($i, 0)},
][..],
)* )* )*
$( $(
&[
- ${ignore(i)} ${count(i, 0)},
- ${ignore(i)} ${count(i, 1)},
+ ${ignore($i)} ${count($i, 0)},
+ ${ignore($i)} ${count($i, 1)},
][..],
)* )*
$(
&[
- ${ignore(i)} ${count(i, 0)},
- ${ignore(i)} ${count(i, 1)},
- ${ignore(i)} ${count(i, 2)},
+ ${ignore($i)} ${count($i, 0)},
+ ${ignore($i)} ${count($i, 1)},
+ ${ignore($i)} ${count($i, 2)},
][..],
)*
&[
- ${count(i, 0)},
- ${count(i, 1)},
- ${count(i, 2)},
- ${count(i, 3)},
+ ${count($i, 0)},
+ ${count($i, 1)},
+ ${count($i, 2)},
+ ${count($i, 3)},
][..]
][..]
}
@@ -133,23 +133,23 @@ fn main() {
&[7][..],
// (a b c) (d e f)
- &[2, 6][..],
+ &[6, 2][..],
// (g h) (i j k l m)
- &[2, 7][..],
+ &[7, 2][..],
// (n)
&[1, 1][..],
// (o) (p q) (r s)
- &[3, 5][..],
+ &[5, 3][..],
// (t u v w x y z)
- &[1, 7][..],
+ &[7, 1][..],
// [ (a b c) (d e f) ]
// [ (g h) (i j k l m) ]
// [ (n) ]
- &[3, 5, 14][..],
+ &[14, 5, 3][..],
// [ (o) (p q) (r s) ]
// [ (t u v w x y z) ]
- &[2, 4, 12][..],
+ &[12, 4, 2][..],
// {
// [ (a b c) (d e f) ]
@@ -160,7 +160,7 @@ fn main() {
// [ (o) (p q) (r s) ]
// [ (t u v w x y z) ]
// }
- &[2, 5, 9, 26][..]
+ &[26, 9, 5, 2][..]
][..]
);
@@ -170,31 +170,31 @@ fn main() {
&[
$( $( $( $(
&[
- ${ignore(i)} ${length(3)},
- ${ignore(i)} ${length(2)},
- ${ignore(i)} ${length(1)},
- ${ignore(i)} ${length(0)},
+ ${ignore($i)} ${length(3)},
+ ${ignore($i)} ${length(2)},
+ ${ignore($i)} ${length(1)},
+ ${ignore($i)} ${length(0)},
][..],
)* )* )* )*
$( $( $(
&[
- ${ignore(i)} ${length(2)},
- ${ignore(i)} ${length(1)},
- ${ignore(i)} ${length(0)},
+ ${ignore($i)} ${length(2)},
+ ${ignore($i)} ${length(1)},
+ ${ignore($i)} ${length(0)},
][..],
)* )* )*
$( $(
&[
- ${ignore(i)} ${length(1)},
- ${ignore(i)} ${length(0)},
+ ${ignore($i)} ${length(1)},
+ ${ignore($i)} ${length(0)},
][..],
)* )*
$(
&[
- ${ignore(i)} ${length(0)},
+ ${ignore($i)} ${length(0)},
][..],
)*
][..]
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs b/tests/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs
index d05cd1b31..950e70153 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs
+++ b/tests/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs
@@ -5,14 +5,14 @@
/// Count the number of idents in a macro repetition.
macro_rules! count_idents {
( $( $i:ident ),* ) => {
- ${count(i)}
+ ${count($i)}
};
}
/// Count the number of idents in a 2-dimensional macro repetition.
macro_rules! count_idents_2 {
( $( [ $( $i:ident ),* ] ),* ) => {
- ${count(i)}
+ ${count($i)}
};
}
@@ -21,17 +21,17 @@ macro_rules! count_depth_limits {
( $( { $( [ $( $outer:ident : ( $( $inner:ident )* ) )* ] )* } )* ) => {
(
(
- ${count(inner)},
- ${count(inner, 0)},
- ${count(inner, 1)},
- ${count(inner, 2)},
- ${count(inner, 3)},
+ ${count($inner)},
+ ${count($inner, 0)},
+ ${count($inner, 1)},
+ ${count($inner, 2)},
+ ${count($inner, 3)},
),
(
- ${count(outer)},
- ${count(outer, 0)},
- ${count(outer, 1)},
- ${count(outer, 2)},
+ ${count($outer)},
+ ${count($outer, 0)},
+ ${count($outer, 1)},
+ ${count($outer, 2)},
),
)
};
@@ -43,7 +43,7 @@ macro_rules! count_depth_limits {
/// repetition binding.
macro_rules! enumerate_literals {
( $( ($l:stmt) ),* ) => {
- [$( ${ignore(l)} (${index()}, ${length()}) ),*]
+ [$( ${ignore($l)} (${index()}, ${length()}) ),*]
};
}
@@ -77,7 +77,7 @@ macro_rules! make_count_adders {
$(
macro_rules! $i {
( $$( $$j:ident ),* ) => {
- $b + $${count(j)}
+ $b + $${count($j)}
};
}
)*
@@ -122,7 +122,7 @@ fn main() {
[ T: (t u v w x y z) ]
}
},
- ((26, 2, 5, 9, 26), (9, 2, 5, 9))
+ ((26, 26, 9, 5, 2), (9, 9, 5, 2))
);
assert_eq!(enumerate_literals![("foo"), ("bar")], [(0, 2), (1, 2)]);
assert_eq!(
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs
index 9cc572c23..3000bfed6 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs
+++ b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs
@@ -1,7 +1,7 @@
#![feature(macro_metavar_expr)]
macro_rules! foo {
- ( $( $($t:ident),* );* ) => { ${count(t,)} }
+ ( $( $($t:ident),* );* ) => { ${count($t,)} }
//~^ ERROR `count` followed by a comma must have an associated
//~| ERROR expected expression, found `$`
}
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr
index e9317a5c3..fd53c1686 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr
+++ b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr
@@ -1,13 +1,13 @@
error: `count` followed by a comma must have an associated index indicating its depth
--> $DIR/issue-111904.rs:4:37
|
-LL | ( $( $($t:ident),* );* ) => { ${count(t,)} }
+LL | ( $( $($t:ident),* );* ) => { ${count($t,)} }
| ^^^^^
error: expected expression, found `$`
--> $DIR/issue-111904.rs:4:35
|
-LL | ( $( $($t:ident),* );* ) => { ${count(t,)} }
+LL | ( $( $($t:ident),* );* ) => { ${count($t,)} }
| ^ expected expression
...
LL | foo!(a, a; b, b);
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/macro-expansion.rs b/tests/ui/macros/rfc-3086-metavar-expr/macro-expansion.rs
index b954967c4..04924f0ef 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/macro-expansion.rs
+++ b/tests/ui/macros/rfc-3086-metavar-expr/macro-expansion.rs
@@ -13,17 +13,17 @@ macro_rules! example {
( $( [ $( ( $( $x:ident )* ) )* ] )* ) => {
Example {
_indexes: &[],
- _counts: &[${count(x, 0)}, ${count(x, 1)}, ${count(x, 2)}],
+ _counts: &[${count($x, 0)}, ${count($x, 1)}, ${count($x, 2)}],
_nested: vec![
$(
Example {
_indexes: &[(${index()}, ${length()})],
- _counts: &[${count(x, 0)}, ${count(x, 1)}],
+ _counts: &[${count($x, 0)}, ${count($x, 1)}],
_nested: vec![
$(
Example {
_indexes: &[(${index(1)}, ${length(1)}), (${index()}, ${length()})],
- _counts: &[${count(x)}],
+ _counts: &[${count($x)}],
_nested: vec![
$(
Example {
@@ -34,7 +34,7 @@ macro_rules! example {
],
_counts: &[],
_nested: vec![],
- ${ignore(x)}
+ ${ignore($x)}
}
),*
]
@@ -49,9 +49,9 @@ macro_rules! example {
}
static EXPECTED: &str = concat!(
- "Example { _indexes: [], _counts: [2, 4, 13], _nested: [",
+ "Example { _indexes: [], _counts: [13, 4, 2], _nested: [",
concat!(
- "Example { _indexes: [(0, 2)], _counts: [3, 10], _nested: [",
+ "Example { _indexes: [(0, 2)], _counts: [10, 3], _nested: [",
concat!(
"Example { _indexes: [(0, 2), (0, 3)], _counts: [4], _nested: [",
concat!(
@@ -77,7 +77,7 @@ static EXPECTED: &str = concat!(
"] }",
),
"] }, ",
- "Example { _indexes: [(1, 2)], _counts: [1, 3], _nested: [",
+ "Example { _indexes: [(1, 2)], _counts: [3, 1], _nested: [",
concat!(
"Example { _indexes: [(1, 2), (0, 1)], _counts: [3], _nested: [",
concat!(
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.rs b/tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.rs
index 6a0d68bd6..d195506af 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.rs
+++ b/tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.rs
@@ -3,9 +3,9 @@
macro_rules! a {
( $( { $( [ $( ( $( $foo:ident )* ) )* ] )* } )* ) => {
(
- ${count(foo, 0)},
- ${count(foo, 10)},
- //~^ ERROR depth parameter on meta-variable expression `count` must be less than 4
+ ${count($foo, 0)},
+ ${count($foo, 10)},
+ //~^ ERROR depth parameter of meta-variable expression `count` must be less than 4
)
};
}
@@ -14,10 +14,10 @@ macro_rules! b {
( $( { $( [ $( $foo:ident )* ] )* } )* ) => {
(
$( $( $(
- ${ignore(foo)}
+ ${ignore($foo)}
${index(0)},
${index(10)},
- //~^ ERROR depth parameter on meta-variable expression `index` must be less than 3
+ //~^ ERROR depth parameter of meta-variable expression `index` must be less than 3
)* )* )*
)
};
@@ -27,10 +27,10 @@ macro_rules! c {
( $( { $( $foo:ident )* } )* ) => {
(
$( $(
- ${ignore(foo)}
+ ${ignore($foo)}
${length(0)}
${length(10)}
- //~^ ERROR depth parameter on meta-variable expression `length` must be less than 2
+ //~^ ERROR depth parameter of meta-variable expression `length` must be less than 2
)* )*
)
};
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.stderr b/tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.stderr
index 236122b64..f757b8af2 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.stderr
+++ b/tests/ui/macros/rfc-3086-metavar-expr/out-of-bounds-arguments.stderr
@@ -1,16 +1,16 @@
-error: depth parameter on meta-variable expression `count` must be less than 4
+error: depth parameter of meta-variable expression `count` must be less than 4
--> $DIR/out-of-bounds-arguments.rs:7:14
|
-LL | ${count(foo, 10)},
- | ^^^^^^^^^^^^^^^^
+LL | ${count($foo, 10)},
+ | ^^^^^^^^^^^^^^^^^
-error: depth parameter on meta-variable expression `index` must be less than 3
+error: depth parameter of meta-variable expression `index` must be less than 3
--> $DIR/out-of-bounds-arguments.rs:19:18
|
LL | ${index(10)},
| ^^^^^^^^^^^
-error: depth parameter on meta-variable expression `length` must be less than 2
+error: depth parameter of meta-variable expression `length` must be less than 2
--> $DIR/out-of-bounds-arguments.rs:32:18
|
LL | ${length(10)}
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/required-feature.rs b/tests/ui/macros/rfc-3086-metavar-expr/required-feature.rs
index b4fef11f1..53d045700 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/required-feature.rs
+++ b/tests/ui/macros/rfc-3086-metavar-expr/required-feature.rs
@@ -1,6 +1,6 @@
macro_rules! count {
( $( $e:stmt ),* ) => {
- ${ count(e) }
+ ${ count($e) }
//~^ ERROR meta-variable expressions are unstable
};
}
@@ -19,7 +19,7 @@ macro_rules! dollar_dollar {
macro_rules! index {
( $( $e:stmt ),* ) => {
- $( ${ignore(e)} ${index()} )*
+ $( ${ignore($e)} ${index()} )*
//~^ ERROR meta-variable expressions are unstable
//~| ERROR meta-variable expressions are unstable
};
@@ -27,14 +27,14 @@ macro_rules! index {
macro_rules! ignore {
( $( $i:stmt ),* ) => {{
- 0 $( + 1 ${ignore(i)} )*
+ 0 $( + 1 ${ignore($i)} )*
//~^ ERROR meta-variable expressions are unstable
}};
}
macro_rules! length {
( $( $e:stmt ),* ) => {
- $( ${ignore(e)} ${length()} )*
+ $( ${ignore($e)} ${length()} )*
//~^ ERROR meta-variable expressions are unstable
//~| ERROR meta-variable expressions are unstable
};
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/required-feature.stderr b/tests/ui/macros/rfc-3086-metavar-expr/required-feature.stderr
index ecf598b10..2c2cbb15b 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/required-feature.stderr
+++ b/tests/ui/macros/rfc-3086-metavar-expr/required-feature.stderr
@@ -1,8 +1,8 @@
error[E0658]: meta-variable expressions are unstable
--> $DIR/required-feature.rs:3:10
|
-LL | ${ count(e) }
- | ^^^^^^^^^^^^
+LL | ${ count($e) }
+ | ^^^^^^^^^^^^^
|
= 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
@@ -46,17 +46,17 @@ LL | ( $$( $$any:tt )* ) => { $$( $$any )* };
error[E0658]: meta-variable expressions are unstable
--> $DIR/required-feature.rs:22:13
|
-LL | $( ${ignore(e)} ${index()} )*
- | ^^^^^^^^^^^
+LL | $( ${ignore($e)} ${index()} )*
+ | ^^^^^^^^^^^^
|
= 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
error[E0658]: meta-variable expressions are unstable
- --> $DIR/required-feature.rs:22:26
+ --> $DIR/required-feature.rs:22:27
|
-LL | $( ${ignore(e)} ${index()} )*
- | ^^^^^^^^^
+LL | $( ${ignore($e)} ${index()} )*
+ | ^^^^^^^^^
|
= 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
@@ -64,8 +64,8 @@ LL | $( ${ignore(e)} ${index()} )*
error[E0658]: meta-variable expressions are unstable
--> $DIR/required-feature.rs:30:19
|
-LL | 0 $( + 1 ${ignore(i)} )*
- | ^^^^^^^^^^^
+LL | 0 $( + 1 ${ignore($i)} )*
+ | ^^^^^^^^^^^^
|
= 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
@@ -73,17 +73,17 @@ LL | 0 $( + 1 ${ignore(i)} )*
error[E0658]: meta-variable expressions are unstable
--> $DIR/required-feature.rs:37:13
|
-LL | $( ${ignore(e)} ${length()} )*
- | ^^^^^^^^^^^
+LL | $( ${ignore($e)} ${length()} )*
+ | ^^^^^^^^^^^^
|
= 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
error[E0658]: meta-variable expressions are unstable
- --> $DIR/required-feature.rs:37:26
+ --> $DIR/required-feature.rs:37:27
|
-LL | $( ${ignore(e)} ${length()} )*
- | ^^^^^^^^^^
+LL | $( ${ignore($e)} ${length()} )*
+ | ^^^^^^^^^^
|
= 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
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs
index fdf16442d..05c65fe86 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs
+++ b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs
@@ -5,24 +5,17 @@
// `round` = Left hand side round brackets
macro_rules! curly__no_rhs_dollar__round {
- ( $( $i:ident ),* ) => { ${ count(i) } };
+ ( $( $i:ident ),* ) => { ${ count($i) } };
}
macro_rules! curly__no_rhs_dollar__no_round {
- ( $i:ident ) => { ${ count(i) } };
+ ( $i:ident ) => { ${ count($i) } };
//~^ ERROR `count` can not be placed inside the inner-most repetition
}
-macro_rules! curly__rhs_dollar__round {
- ( $( $i:ident ),* ) => { ${ count($i) } };
- //~^ ERROR expected identifier, found `$`
- //~| ERROR expected expression, found `$`
-}
-
macro_rules! curly__rhs_dollar__no_round {
( $i:ident ) => { ${ count($i) } };
- //~^ ERROR expected identifier, found `$`
- //~| ERROR expected expression, found `$`
+ //~^ ERROR `count` can not be placed inside the inner-most repetition
}
macro_rules! no_curly__no_rhs_dollar__round {
@@ -60,16 +53,16 @@ macro_rules! extra_garbage_after_metavar {
${count() a b c}
//~^ ERROR unexpected token: a
//~| ERROR expected expression, found `$`
- ${count(i a b c)}
+ ${count($i a b c)}
//~^ ERROR unexpected token: a
- ${count(i, 1 a b c)}
+ ${count($i, 1 a b c)}
//~^ ERROR unexpected token: a
- ${count(i) a b c}
+ ${count($i) a b c}
//~^ ERROR unexpected token: a
- ${ignore(i) a b c}
+ ${ignore($i) a b c}
//~^ ERROR unexpected token: a
- ${ignore(i a b c)}
+ ${ignore($i a b c)}
//~^ ERROR unexpected token: a
${index() a b c}
@@ -100,8 +93,8 @@ macro_rules! metavar_in_the_lhs {
macro_rules! metavar_token_without_ident {
( $( $i:ident ),* ) => { ${ ignore() } };
- //~^ ERROR expected identifier
- //~| ERROR expected expression, found `$`
+ //~^ ERROR meta-variable expressions must be referenced using a dollar sign
+ //~| ERROR expected expression
}
macro_rules! metavar_with_literal_suffix {
@@ -125,14 +118,16 @@ macro_rules! open_brackets_without_tokens {
macro_rules! unknown_count_ident {
( $( $i:ident )* ) => {
${count(foo)}
- //~^ ERROR variable `foo` is not recognized in meta-variable expression
+ //~^ ERROR meta-variable expressions must be referenced using a dollar sign
+ //~| ERROR expected expression
};
}
macro_rules! unknown_ignore_ident {
( $( $i:ident )* ) => {
${ignore(bar)}
- //~^ ERROR variable `bar` is not recognized in meta-variable expression
+ //~^ ERROR meta-variable expressions must be referenced using a dollar sign
+ //~| ERROR expected expression
};
}
@@ -145,7 +140,6 @@ macro_rules! unknown_metavar {
fn main() {
curly__no_rhs_dollar__round!(a, b, c);
curly__no_rhs_dollar__no_round!(a);
- curly__rhs_dollar__round!(a, b, c);
curly__rhs_dollar__no_round!(a);
no_curly__no_rhs_dollar__round!(a, b, c);
no_curly__no_rhs_dollar__no_round!(a);
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr
index a6cff95fd..0dda38290 100644
--- a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr
+++ b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr
@@ -1,197 +1,197 @@
-error: expected identifier, found `$`
- --> $DIR/syntax-errors.rs:17:33
- |
-LL | ( $( $i:ident ),* ) => { ${ count($i) } };
- | ^^^^^ - help: try removing `$`
-
-error: expected identifier, found `$`
- --> $DIR/syntax-errors.rs:23:26
- |
-LL | ( $i:ident ) => { ${ count($i) } };
- | ^^^^^ - help: try removing `$`
-
error: unexpected token: $
- --> $DIR/syntax-errors.rs:53:8
+ --> $DIR/syntax-errors.rs:46:8
|
LL | ( $$ $a:ident ) => {
| ^
note: `$$` and meta-variable expressions are not allowed inside macro parameter definitions
- --> $DIR/syntax-errors.rs:53:8
+ --> $DIR/syntax-errors.rs:46:8
|
LL | ( $$ $a:ident ) => {
| ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:60:19
+ --> $DIR/syntax-errors.rs:53:19
|
LL | ${count() a b c}
| ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:60:19
+ --> $DIR/syntax-errors.rs:53:19
|
LL | ${count() a b c}
| ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:63:19
+ --> $DIR/syntax-errors.rs:56:20
|
-LL | ${count(i a b c)}
- | ^
+LL | ${count($i a b c)}
+ | ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:63:19
+ --> $DIR/syntax-errors.rs:56:20
|
-LL | ${count(i a b c)}
- | ^
+LL | ${count($i a b c)}
+ | ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:65:22
+ --> $DIR/syntax-errors.rs:58:23
|
-LL | ${count(i, 1 a b c)}
- | ^
+LL | ${count($i, 1 a b c)}
+ | ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:65:22
+ --> $DIR/syntax-errors.rs:58:23
|
-LL | ${count(i, 1 a b c)}
- | ^
+LL | ${count($i, 1 a b c)}
+ | ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:67:20
+ --> $DIR/syntax-errors.rs:60:21
|
-LL | ${count(i) a b c}
- | ^
+LL | ${count($i) a b c}
+ | ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:67:20
+ --> $DIR/syntax-errors.rs:60:21
|
-LL | ${count(i) a b c}
- | ^
+LL | ${count($i) a b c}
+ | ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:70:21
+ --> $DIR/syntax-errors.rs:63:22
|
-LL | ${ignore(i) a b c}
- | ^
+LL | ${ignore($i) a b c}
+ | ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:70:21
+ --> $DIR/syntax-errors.rs:63:22
|
-LL | ${ignore(i) a b c}
- | ^
+LL | ${ignore($i) a b c}
+ | ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:72:20
+ --> $DIR/syntax-errors.rs:65:21
|
-LL | ${ignore(i a b c)}
- | ^
+LL | ${ignore($i a b c)}
+ | ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:72:20
+ --> $DIR/syntax-errors.rs:65:21
|
-LL | ${ignore(i a b c)}
- | ^
+LL | ${ignore($i a b c)}
+ | ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:75:19
+ --> $DIR/syntax-errors.rs:68:19
|
LL | ${index() a b c}
| ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:75:19
+ --> $DIR/syntax-errors.rs:68:19
|
LL | ${index() a b c}
| ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:77:19
+ --> $DIR/syntax-errors.rs:70:19
|
LL | ${index(1 a b c)}
| ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:77:19
+ --> $DIR/syntax-errors.rs:70:19
|
LL | ${index(1 a b c)}
| ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:80:19
+ --> $DIR/syntax-errors.rs:73:19
|
LL | ${index() a b c}
| ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:80:19
+ --> $DIR/syntax-errors.rs:73:19
|
LL | ${index() a b c}
| ^
error: unexpected token: a
- --> $DIR/syntax-errors.rs:82:19
+ --> $DIR/syntax-errors.rs:75:19
|
LL | ${index(1 a b c)}
| ^
|
note: meta-variable expression must not have trailing tokens
- --> $DIR/syntax-errors.rs:82:19
+ --> $DIR/syntax-errors.rs:75:19
|
LL | ${index(1 a b c)}
| ^
error: meta-variable expression depth must be a literal
- --> $DIR/syntax-errors.rs:89:33
+ --> $DIR/syntax-errors.rs:82:33
|
LL | ( $( $i:ident ),* ) => { ${ index(IDX) } };
| ^^^^^
error: unexpected token: {
- --> $DIR/syntax-errors.rs:95:8
+ --> $DIR/syntax-errors.rs:88:8
|
LL | ( ${ length() } ) => {
| ^^^^^^^^^^^^
note: `$$` and meta-variable expressions are not allowed inside macro parameter definitions
- --> $DIR/syntax-errors.rs:95:8
+ --> $DIR/syntax-errors.rs:88:8
|
LL | ( ${ length() } ) => {
| ^^^^^^^^^^^^
error: expected one of: `*`, `+`, or `?`
- --> $DIR/syntax-errors.rs:95:8
+ --> $DIR/syntax-errors.rs:88:8
|
LL | ( ${ length() } ) => {
| ^^^^^^^^^^^^
-error: expected identifier
- --> $DIR/syntax-errors.rs:102:33
+error: meta-variables within meta-variable expressions must be referenced using a dollar sign
+ --> $DIR/syntax-errors.rs:95:33
|
LL | ( $( $i:ident ),* ) => { ${ ignore() } };
| ^^^^^^
error: only unsuffixes integer literals are supported in meta-variable expressions
- --> $DIR/syntax-errors.rs:108:33
+ --> $DIR/syntax-errors.rs:101:33
|
LL | ( $( $i:ident ),* ) => { ${ index(1u32) } };
| ^^^^^
error: meta-variable expression parameter must be wrapped in parentheses
- --> $DIR/syntax-errors.rs:114:33
+ --> $DIR/syntax-errors.rs:107:33
|
LL | ( $( $i:ident ),* ) => { ${ count{i} } };
| ^^^^^
error: expected identifier
- --> $DIR/syntax-errors.rs:120:31
+ --> $DIR/syntax-errors.rs:113:31
|
LL | ( $( $i:ident ),* ) => { ${ {} } };
| ^^^^^^
+error: meta-variables within meta-variable expressions must be referenced using a dollar sign
+ --> $DIR/syntax-errors.rs:120:11
+ |
+LL | ${count(foo)}
+ | ^^^^^
+
+error: meta-variables within meta-variable expressions must be referenced using a dollar sign
+ --> $DIR/syntax-errors.rs:128:11
+ |
+LL | ${ignore(bar)}
+ | ^^^^^^
+
error: unrecognized meta-variable expression
- --> $DIR/syntax-errors.rs:140:33
+ --> $DIR/syntax-errors.rs:135:33
|
LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } };
| ^^^^^^^^^^^^^^ help: supported expressions are count, ignore, index and length
@@ -199,39 +199,23 @@ LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } };
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:17:30
- |
-LL | ( $( $i:ident ),* ) => { ${ count($i) } };
- | ^ expected expression
-...
-LL | curly__rhs_dollar__round!(a, b, c);
- | ---------------------------------- in this macro invocation
- |
- = note: this error originates in the macro `curly__rhs_dollar__round` (in Nightly builds, run with -Z macro-backtrace for more info)
+LL | ( $i:ident ) => { ${ count($i) } };
+ | ^^^^^^^^^^^^^
-error: expected expression, found `$`
- --> $DIR/syntax-errors.rs:23:23
+error: `count` can not be placed inside the inner-most repetition
+ --> $DIR/syntax-errors.rs:17:24
|
LL | ( $i:ident ) => { ${ count($i) } };
- | ^ expected expression
-...
-LL | curly__rhs_dollar__no_round!(a);
- | ------------------------------- in this macro invocation
- |
- = 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:41:36
+ --> $DIR/syntax-errors.rs:34:36
|
LL | ( $( $i:ident ),* ) => { count($i) };
| ^^
error: expected expression, found `$`
- --> $DIR/syntax-errors.rs:60:9
+ --> $DIR/syntax-errors.rs:53:9
|
LL | ${count() a b c}
| ^ expected expression
@@ -242,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)
error: expected expression, found `$`
- --> $DIR/syntax-errors.rs:89:30
+ --> $DIR/syntax-errors.rs:82:30
|
LL | ( $( $i:ident ),* ) => { ${ index(IDX) } };
| ^ expected expression
@@ -253,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)
error: expected expression, found `$`
- --> $DIR/syntax-errors.rs:102:30
+ --> $DIR/syntax-errors.rs:95:30
|
LL | ( $( $i:ident ),* ) => { ${ ignore() } };
| ^ expected expression
@@ -264,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)
error: expected expression, found `$`
- --> $DIR/syntax-errors.rs:108:30
+ --> $DIR/syntax-errors.rs:101:30
|
LL | ( $( $i:ident ),* ) => { ${ index(1u32) } };
| ^ expected expression
@@ -275,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)
error: expected expression, found `$`
- --> $DIR/syntax-errors.rs:114:30
+ --> $DIR/syntax-errors.rs:107:30
|
LL | ( $( $i:ident ),* ) => { ${ count{i} } };
| ^ expected expression
@@ -286,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)
error: expected expression, found `$`
- --> $DIR/syntax-errors.rs:120:30
+ --> $DIR/syntax-errors.rs:113:30
|
LL | ( $( $i:ident ),* ) => { ${ {} } };
| ^ expected expression
@@ -296,20 +280,30 @@ 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)
-error: variable `foo` is not recognized in meta-variable expression
- --> $DIR/syntax-errors.rs:127:17
+error: expected expression, found `$`
+ --> $DIR/syntax-errors.rs:120:9
|
LL | ${count(foo)}
- | ^^^
+ | ^ expected expression
+...
+LL | unknown_count_ident!(a);
+ | ----------------------- in this macro invocation
+ |
+ = note: this error originates in the macro `unknown_count_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: variable `bar` is not recognized in meta-variable expression
- --> $DIR/syntax-errors.rs:134:18
+error: expected expression, found `$`
+ --> $DIR/syntax-errors.rs:128:9
|
LL | ${ignore(bar)}
- | ^^^
+ | ^ expected expression
+...
+LL | unknown_ignore_ident!(a);
+ | ------------------------ in this macro invocation
+ |
+ = 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 `$`
- --> $DIR/syntax-errors.rs:140:30
+ --> $DIR/syntax-errors.rs:135:30
|
LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } };
| ^ expected expression
@@ -320,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)
error[E0425]: cannot find value `i` in this scope
- --> $DIR/syntax-errors.rs:29:36
+ --> $DIR/syntax-errors.rs:22:36
|
LL | ( $( $i:ident ),* ) => { count(i) };
| ^ not found in this scope
@@ -331,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)
error[E0425]: cannot find value `i` in this scope
- --> $DIR/syntax-errors.rs:35:29
+ --> $DIR/syntax-errors.rs:28:29
|
LL | ( $i:ident ) => { count(i) };
| ^ not found in this scope
@@ -342,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)
error[E0425]: cannot find value `a` in this scope
- --> $DIR/syntax-errors.rs:153:37
+ --> $DIR/syntax-errors.rs:147:37
|
LL | no_curly__rhs_dollar__no_round!(a);
| ^ not found in this scope
error[E0425]: cannot find function `count` in this scope
- --> $DIR/syntax-errors.rs:29:30
+ --> $DIR/syntax-errors.rs:22:30
|
LL | ( $( $i:ident ),* ) => { count(i) };
| ^^^^^ not found in this scope
@@ -359,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)
error[E0425]: cannot find function `count` in this scope
- --> $DIR/syntax-errors.rs:35:23
+ --> $DIR/syntax-errors.rs:28:23
|
LL | ( $i:ident ) => { count(i) };
| ^^^^^ not found in this scope
@@ -370,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:46:23
+ --> $DIR/syntax-errors.rs:39:23
|
LL | ( $i:ident ) => { count($i) };
| ^^^^^ not found in this scope
@@ -380,6 +374,6 @@ 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: aborting due to 40 previous errors
+error: aborting due to 39 previous errors
For more information about this error, try `rustc --explain E0425`.