File tree 2 files changed +29
-5
lines changed
2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -302,11 +302,20 @@ impl<'a> Parser<'a> {
302
302
if i + 1 < tts. len ( ) {
303
303
self . tts . push ( ( tts, i + 1 ) ) ;
304
304
}
305
- if let TokenTree :: Token ( sp, tok) = tt {
306
- TokenAndSpan { tok : tok, sp : sp }
307
- } else {
308
- self . tts . push ( ( tt, 0 ) ) ;
309
- continue
305
+ // FIXME(jseyfried): remove after fixing #39390 in #39419.
306
+ if self . quote_depth > 0 {
307
+ if let TokenTree :: Sequence ( sp, _) = tt {
308
+ self . span_err ( sp, "attempted to repeat an expression containing no \
309
+ syntax variables matched as repeating at this depth") ;
310
+ }
311
+ }
312
+ match tt {
313
+ TokenTree :: Token ( sp, tok) => TokenAndSpan { tok : tok, sp : sp } ,
314
+ _ if tt. len ( ) > 0 => {
315
+ self . tts . push ( ( tt, 0 ) ) ;
316
+ continue
317
+ }
318
+ _ => continue ,
310
319
}
311
320
} else {
312
321
TokenAndSpan { tok : token:: Eof , sp : self . span }
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn main ( ) {
12
+ println ! ( "{}" , { macro_rules! x { ( $( ) * ) => { } } 33 } ) ;
13
+ //~^ ERROR no syntax variables matched as repeating at this depth
14
+ }
15
+
You can’t perform that action at this time.
0 commit comments