Fix panic with unterminated interpolated string.

This commit is contained in:
Stephen Chung
2021-04-10 17:47:44 +08:00
parent 40fda5139d
commit 6b4553ffc8
2 changed files with 15 additions and 0 deletions

View File

@@ -1039,6 +1039,9 @@ fn parse_primary(
segments.push(Expr::StringConstant(s.into(), pos));
}
}
(Token::LexError(err @ LexError::UnterminatedString), pos) => {
return Err(err.into_err(pos))
}
(token, _) => unreachable!(
"expected a string within an interpolated string literal, but gets {:?}",
token