Panic when unmatched delimiters aren't emitted
This commit is contained in:
parent
e38e915cdf
commit
c70a516c23
2 changed files with 8 additions and 1 deletions
|
@ -761,7 +761,7 @@ pub fn parse(
|
|||
else if bb_items.is_empty() && next_items.is_empty() {
|
||||
return Failure(
|
||||
parser.span,
|
||||
parser.token,
|
||||
parser.token.clone(),
|
||||
"no rules expected this token in macro call",
|
||||
);
|
||||
}
|
||||
|
|
|
@ -259,6 +259,13 @@ pub struct Parser<'a> {
|
|||
last_unexpected_token_span: Option<Span>,
|
||||
}
|
||||
|
||||
impl<'a> Drop for Parser<'a> {
|
||||
fn drop(&mut self) {
|
||||
if !self.unclosed_delims.is_empty() {
|
||||
panic!("unclosed delimiter errors not emitted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct TokenCursor {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue