about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2013-11-26 23:54:32 +0100
committerFlorian Hahn <flo@fhahn.com>2014-01-01 23:36:57 +0100
commitf42a36cded2ac71e36b2572c54da0fc623af2eca (patch)
tree80886ea0826589bc767f3b50171dd33894d026ef /src/libsyntax/parse/parser.rs
parent51ace54597984b221321d1cac0f80c50f9e00f71 (diff)
downloadrust-f42a36cded2ac71e36b2572c54da0fc623af2eca.tar.gz
rust-f42a36cded2ac71e36b2572c54da0fc623af2eca.zip
Remove `extern mod foo (name="bar")` syntax, closes #9543
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 729d0320435..5e2b022d175 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4446,11 +4446,18 @@ impl Parser {
             self.span_err(*self.span, "an ABI may not be specified here");
         }
 
+
+        if *self.token == token::LPAREN {
+            // `extern mod foo (name = "bar"[,vers = "version"]) is obsolete,
+            // `extern mod foo = "bar#[version]";` should be used.
+            // Parse obsolete options to avoid wired parser errors
+            self.parse_optional_meta();
+            self.obsolete(*self.span, ObsoleteExternModAttributesInParens);
+        }
         // extern mod foo;
-        let metadata = self.parse_optional_meta();
         self.expect(&token::SEMI);
         iovi_view_item(ast::view_item {
-            node: view_item_extern_mod(ident, maybe_path, metadata, ast::DUMMY_NODE_ID),
+            node: view_item_extern_mod(ident, maybe_path, ast::DUMMY_NODE_ID),
             attrs: attrs,
             vis: visibility,
             span: mk_sp(lo, self.last_span.hi)