about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-03-03 11:13:19 -0800
committerEsteban Küber <esteban@kuber.com.ar>2019-03-06 18:46:11 -0800
commitc70a516c23ae19ce568166a81e64c92a4ecf540a (patch)
tree0dd227e79912e84dfbb6d446ec5d0926094cece7 /src
parente38e915cdfaecb5a89d9bf2b041f19c6598ade09 (diff)
downloadrust-c70a516c23ae19ce568166a81e64c92a4ecf540a.tar.gz
rust-c70a516c23ae19ce568166a81e64c92a4ecf540a.zip
Panic when unmatched delimiters aren't emitted
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs2
-rw-r--r--src/libsyntax/parse/parser.rs7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index fe1cffb092b..1a419e7fada 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -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",
             );
         }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 0187ad743aa..33fe81ea8c4 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -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 {