about summary refs log tree commit diff
path: root/src/comp/syntax/parse/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp/syntax/parse/parser.rs')
-rw-r--r--src/comp/syntax/parse/parser.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 2352ac2f9db..1cfd96c97cb 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -2622,6 +2622,9 @@ fn parse_from_source_str<T>(f: fn (p: parser) -> T,
 {
     let p = new_parser_from_source_str(sess, cfg, name, ss, source);
     let r = f(p);
+    if !p.reader.is_eof() {
+        p.reader.fatal("expected end-of-string");
+    }
     sess.chpos = p.reader.chpos;
     sess.byte_pos = sess.byte_pos + p.reader.pos;
     ret r;