@@ -77,13 +77,13 @@ fn test_metavar_exprs() {
77
77
check (
78
78
r#"
79
79
macro_rules! m {
80
- ( $( $t:tt )* ) => ( $( ${ignore(t)} -${index()} )-* );
80
+ ( $( $t:tt )* ) => ( $( ${ignore($ t)} -${index()} )-* );
81
81
}
82
82
const _: i32 = m!(a b c);
83
83
"# ,
84
84
expect ! [ [ r#"
85
85
macro_rules! m {
86
- ( $( $t:tt )* ) => ( $( ${ignore(t)} -${index()} )-* );
86
+ ( $( $t:tt )* ) => ( $( ${ignore($ t)} -${index()} )-* );
87
87
}
88
88
const _: i32 = -0--1--2;
89
89
"# ] ] ,
@@ -96,7 +96,7 @@ fn count_basic() {
96
96
r#"
97
97
macro_rules! m {
98
98
($($t:ident),*) => {
99
- ${count(t)}
99
+ ${count($ t)}
100
100
}
101
101
}
102
102
@@ -109,7 +109,7 @@ fn test() {
109
109
expect ! [ [ r#"
110
110
macro_rules! m {
111
111
($($t:ident),*) => {
112
- ${count(t)}
112
+ ${count($ t)}
113
113
}
114
114
}
115
115
@@ -130,9 +130,9 @@ macro_rules! foo {
130
130
($( $( $($t:ident)* ),* );*) => {
131
131
$(
132
132
{
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)};
136
136
}
137
137
)*
138
138
}
@@ -150,21 +150,21 @@ macro_rules! foo {
150
150
($( $( $($t:ident)* ),* );*) => {
151
151
$(
152
152
{
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)};
156
156
}
157
157
)*
158
158
}
159
159
}
160
160
161
161
fn bar() {
162
162
{
163
- let depth_none = 6 ;
163
+ let depth_none = 3 ;
164
164
let depth_zero = 3;
165
165
let depth_one = 6;
166
166
} {
167
- let depth_none = 3 ;
167
+ let depth_none = 1 ;
168
168
let depth_zero = 1;
169
169
let depth_one = 3;
170
170
}
@@ -178,12 +178,12 @@ fn count_depth_out_of_bounds() {
178
178
check (
179
179
r#"
180
180
macro_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)};)* }
183
183
}
184
184
macro_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)};)* }
187
187
}
188
188
189
189
fn test() {
@@ -195,19 +195,21 @@ fn test() {
195
195
"# ,
196
196
expect ! [ [ r#"
197
197
macro_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)};)* }
200
200
}
201
201
macro_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)};)* }
204
204
}
205
205
206
206
fn 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;;
211
213
}
212
214
"# ] ] ,
213
215
) ;
@@ -218,8 +220,8 @@ fn misplaced_count() {
218
220
check (
219
221
r#"
220
222
macro_rules! foo {
221
- ($($t:ident)*) => { $(${count(t)})* };
222
- ($l:literal) => { ${count(l)} }
223
+ ($($t:ident)*) => { $(${count($ t)})* };
224
+ ($l:literal) => { ${count($ l)} }
223
225
}
224
226
225
227
fn test() {
@@ -229,13 +231,13 @@ fn test() {
229
231
"# ,
230
232
expect ! [ [ r#"
231
233
macro_rules! foo {
232
- ($($t:ident)*) => { $(${count(t)})* };
233
- ($l:literal) => { ${count(l)} }
234
+ ($($t:ident)*) => { $(${count($ t)})* };
235
+ ($l:literal) => { ${count($ l)} }
234
236
}
235
237
236
238
fn test() {
237
- /* error: ${count} misplaced */ ;
238
- /* error: ${count} misplaced */ ;
239
+ 1 1 1 ;
240
+ 1 ;
239
241
}
240
242
"# ] ] ,
241
243
) ;
@@ -246,13 +248,13 @@ fn malformed_count() {
246
248
check (
247
249
r#"
248
250
macro_rules! too_many_args {
249
- ($($t:ident)*) => { ${count(t, 1, leftover)} }
251
+ ($($t:ident)*) => { ${count($ t, 1, leftover)} }
250
252
}
251
253
macro_rules! depth_suffixed {
252
- ($($t:ident)*) => { ${count(t, 0usize)} }
254
+ ($($t:ident)*) => { ${count($ t, 0usize)} }
253
255
}
254
256
macro_rules! depth_too_large {
255
- ($($t:ident)*) => { ${count(t, 18446744073709551616)} }
257
+ ($($t:ident)*) => { ${count($ t, 18446744073709551616)} }
256
258
}
257
259
258
260
fn test() {
@@ -263,13 +265,13 @@ fn test() {
263
265
"# ,
264
266
expect ! [ [ r#"
265
267
macro_rules! too_many_args {
266
- ($($t:ident)*) => { ${count(t, 1, leftover)} }
268
+ ($($t:ident)*) => { ${count($ t, 1, leftover)} }
267
269
}
268
270
macro_rules! depth_suffixed {
269
- ($($t:ident)*) => { ${count(t, 0usize)} }
271
+ ($($t:ident)*) => { ${count($ t, 0usize)} }
270
272
}
271
273
macro_rules! depth_too_large {
272
- ($($t:ident)*) => { ${count(t, 18446744073709551616)} }
274
+ ($($t:ident)*) => { ${count($ t, 18446744073709551616)} }
273
275
}
274
276
275
277
fn test() {
@@ -288,7 +290,7 @@ fn count_interaction_with_empty_binding() {
288
290
r#"
289
291
macro_rules! m {
290
292
($($t:ident),*) => {
291
- ${count(t, 100)}
293
+ ${count($ t, 100)}
292
294
}
293
295
}
294
296
@@ -299,7 +301,7 @@ fn test() {
299
301
expect ! [ [ r#"
300
302
macro_rules! m {
301
303
($($t:ident),*) => {
302
- ${count(t, 100)}
304
+ ${count($ t, 100)}
303
305
}
304
306
}
305
307
0 commit comments