File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed
Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -304,11 +304,20 @@ impl<'a> Parser<'a> {
304304 if i + 1 < tts. len ( ) {
305305 self . tts . push ( ( tts, i + 1 ) ) ;
306306 }
307- if let TokenTree :: Token ( sp, tok) = tt {
308- TokenAndSpan { tok : tok, sp : sp }
309- } else {
310- self . tts . push ( ( tt, 0 ) ) ;
311- continue
307+ // FIXME(jseyfried): remove after fixing #39390 in #39419.
308+ if self . quote_depth > 0 {
309+ if let TokenTree :: Sequence ( sp, _) = tt {
310+ self . span_err ( sp, "attempted to repeat an expression containing no \
311+ syntax variables matched as repeating at this depth") ;
312+ }
313+ }
314+ match tt {
315+ TokenTree :: Token ( sp, tok) => TokenAndSpan { tok : tok, sp : sp } ,
316+ _ if tt. len ( ) > 0 => {
317+ self . tts . push ( ( tt, 0 ) ) ;
318+ continue
319+ }
320+ _ => continue ,
312321 }
313322 } else {
314323 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