Fix ICE on certain sequence repetitions.
This commit is contained in:
parent
f80514426a
commit
b3d73995da
2 changed files with 29 additions and 5 deletions
|
@ -302,11 +302,20 @@ impl<'a> Parser<'a> {
|
|||
if i + 1 < tts.len() {
|
||||
self.tts.push((tts, i + 1));
|
||||
}
|
||||
if let TokenTree::Token(sp, tok) = tt {
|
||||
TokenAndSpan { tok: tok, sp: sp }
|
||||
} else {
|
||||
self.tts.push((tt, 0));
|
||||
continue
|
||||
// FIXME(jseyfried): remove after fixing #39390 in #39419.
|
||||
if self.quote_depth > 0 {
|
||||
if let TokenTree::Sequence(sp, _) = tt {
|
||||
self.span_err(sp, "attempted to repeat an expression containing no \
|
||||
syntax variables matched as repeating at this depth");
|
||||
}
|
||||
}
|
||||
match tt {
|
||||
TokenTree::Token(sp, tok) => TokenAndSpan { tok: tok, sp: sp },
|
||||
_ if tt.len() > 0 => {
|
||||
self.tts.push((tt, 0));
|
||||
continue
|
||||
}
|
||||
_ => continue,
|
||||
}
|
||||
} else {
|
||||
TokenAndSpan { tok: token::Eof, sp: self.span }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue