@@ -77,13 +77,13 @@ fn test_metavar_exprs() {
7777 check (
7878 r#"
7979macro_rules! m {
80- ( $( $t:tt )* ) => ( $( ${ignore(t)} -${index()} )-* );
80+ ( $( $t:tt )* ) => ( $( ${ignore($ t)} -${index()} )-* );
8181}
8282const _: i32 = m!(a b c);
8383 "# ,
8484 expect ! [ [ r#"
8585macro_rules! m {
86- ( $( $t:tt )* ) => ( $( ${ignore(t)} -${index()} )-* );
86+ ( $( $t:tt )* ) => ( $( ${ignore($ t)} -${index()} )-* );
8787}
8888const _: i32 = -0--1--2;
8989 "# ] ] ,
@@ -96,7 +96,7 @@ fn count_basic() {
9696 r#"
9797macro_rules! m {
9898 ($($t:ident),*) => {
99- ${count(t)}
99+ ${count($ t)}
100100 }
101101}
102102
@@ -109,7 +109,7 @@ fn test() {
109109 expect ! [ [ r#"
110110macro_rules! m {
111111 ($($t:ident),*) => {
112- ${count(t)}
112+ ${count($ t)}
113113 }
114114}
115115
@@ -130,9 +130,9 @@ macro_rules! foo {
130130 ($( $( $($t:ident)* ),* );*) => {
131131 $(
132132 {
133- let depth_none = ${count(t)};
134- let depth_zero = ${count(t, 0)};
135- let depth_one = ${count(t, 1)};
133+ let depth_none = ${count($ t)};
134+ let depth_zero = ${count($ t, 0)};
135+ let depth_one = ${count($ t, 1)};
136136 }
137137 )*
138138 }
@@ -150,21 +150,21 @@ macro_rules! foo {
150150 ($( $( $($t:ident)* ),* );*) => {
151151 $(
152152 {
153- let depth_none = ${count(t)};
154- let depth_zero = ${count(t, 0)};
155- let depth_one = ${count(t, 1)};
153+ let depth_none = ${count($ t)};
154+ let depth_zero = ${count($ t, 0)};
155+ let depth_one = ${count($ t, 1)};
156156 }
157157 )*
158158 }
159159}
160160
161161fn bar() {
162162 {
163- let depth_none = 6 ;
163+ let depth_none = 3 ;
164164 let depth_zero = 3;
165165 let depth_one = 6;
166166 } {
167- let depth_none = 3 ;
167+ let depth_none = 1 ;
168168 let depth_zero = 1;
169169 let depth_one = 3;
170170 }
@@ -178,12 +178,12 @@ fn count_depth_out_of_bounds() {
178178 check (
179179 r#"
180180macro_rules! foo {
181- ($($t:ident)*) => { ${count(t, 1)} };
182- ($( $( $l:literal )* );*) => { $(${count(l, 1)};)* }
181+ ($($t:ident)*) => { ${count($ t, 1)} };
182+ ($( $( $l:literal )* );*) => { $(${count($ l, 1)};)* }
183183}
184184macro_rules! bar {
185- ($($t:ident)*) => { ${count(t, 1024)} };
186- ($( $( $l:literal )* );*) => { $(${count(l, 8192)};)* }
185+ ($($t:ident)*) => { ${count($ t, 1024)} };
186+ ($( $( $l:literal )* );*) => { $(${count($ l, 8192)};)* }
187187}
188188
189189fn test() {
@@ -195,19 +195,21 @@ fn test() {
195195"# ,
196196 expect ! [ [ r#"
197197macro_rules! foo {
198- ($($t:ident)*) => { ${count(t, 1)} };
199- ($( $( $l:literal )* );*) => { $(${count(l, 1)};)* }
198+ ($($t:ident)*) => { ${count($ t, 1)} };
199+ ($( $( $l:literal )* );*) => { $(${count($ l, 1)};)* }
200200}
201201macro_rules! bar {
202- ($($t:ident)*) => { ${count(t, 1024)} };
203- ($( $( $l:literal )* );*) => { $(${count(l, 8192)};)* }
202+ ($($t:ident)*) => { ${count($ t, 1024)} };
203+ ($( $( $l:literal )* );*) => { $(${count($ l, 8192)};)* }
204204}
205205
206206fn test() {
207- /* error: ${count} out of bounds */;
208- /* error: ${count} out of bounds */;
209- /* error: ${count} out of bounds */;
210- /* error: ${count} out of bounds */;
207+ 2;
208+ 2;
209+ 1;;
210+ 2;
211+ 2;
212+ 1;;
211213}
212214"# ] ] ,
213215 ) ;
@@ -218,8 +220,8 @@ fn misplaced_count() {
218220 check (
219221 r#"
220222macro_rules! foo {
221- ($($t:ident)*) => { $(${count(t)})* };
222- ($l:literal) => { ${count(l)} }
223+ ($($t:ident)*) => { $(${count($ t)})* };
224+ ($l:literal) => { ${count($ l)} }
223225}
224226
225227fn test() {
@@ -229,13 +231,13 @@ fn test() {
229231"# ,
230232 expect ! [ [ r#"
231233macro_rules! foo {
232- ($($t:ident)*) => { $(${count(t)})* };
233- ($l:literal) => { ${count(l)} }
234+ ($($t:ident)*) => { $(${count($ t)})* };
235+ ($l:literal) => { ${count($ l)} }
234236}
235237
236238fn test() {
237- /* error: ${count} misplaced */ ;
238- /* error: ${count} misplaced */ ;
239+ 1 1 1 ;
240+ 1 ;
239241}
240242"# ] ] ,
241243 ) ;
@@ -246,13 +248,13 @@ fn malformed_count() {
246248 check (
247249 r#"
248250macro_rules! too_many_args {
249- ($($t:ident)*) => { ${count(t, 1, leftover)} }
251+ ($($t:ident)*) => { ${count($ t, 1, leftover)} }
250252}
251253macro_rules! depth_suffixed {
252- ($($t:ident)*) => { ${count(t, 0usize)} }
254+ ($($t:ident)*) => { ${count($ t, 0usize)} }
253255}
254256macro_rules! depth_too_large {
255- ($($t:ident)*) => { ${count(t, 18446744073709551616)} }
257+ ($($t:ident)*) => { ${count($ t, 18446744073709551616)} }
256258}
257259
258260fn test() {
@@ -263,13 +265,13 @@ fn test() {
263265"# ,
264266 expect ! [ [ r#"
265267macro_rules! too_many_args {
266- ($($t:ident)*) => { ${count(t, 1, leftover)} }
268+ ($($t:ident)*) => { ${count($ t, 1, leftover)} }
267269}
268270macro_rules! depth_suffixed {
269- ($($t:ident)*) => { ${count(t, 0usize)} }
271+ ($($t:ident)*) => { ${count($ t, 0usize)} }
270272}
271273macro_rules! depth_too_large {
272- ($($t:ident)*) => { ${count(t, 18446744073709551616)} }
274+ ($($t:ident)*) => { ${count($ t, 18446744073709551616)} }
273275}
274276
275277fn test() {
@@ -288,7 +290,7 @@ fn count_interaction_with_empty_binding() {
288290 r#"
289291macro_rules! m {
290292 ($($t:ident),*) => {
291- ${count(t, 100)}
293+ ${count($ t, 100)}
292294 }
293295}
294296
@@ -299,7 +301,7 @@ fn test() {
299301 expect ! [ [ r#"
300302macro_rules! m {
301303 ($($t:ident),*) => {
302- ${count(t, 100)}
304+ ${count($ t, 100)}
303305 }
304306}
305307
0 commit comments