about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/test/compile-fail/obsolete-syntax.rs10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index bb3c185c2a9..dc42b4bdb80 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4196,7 +4196,7 @@ impl Parser {
 
             // Do not allow visibility to be specified.
             if visibility != ast::inherited {
-                self.obsolete(*self.span, ObsoleteExternVisibility);
+                self.obsolete(*self.last_span, ObsoleteExternVisibility);
             }
 
             let abis = opt_abis.get_or_default(AbiSet::C());
diff --git a/src/test/compile-fail/obsolete-syntax.rs b/src/test/compile-fail/obsolete-syntax.rs
index 65ba4ed6e00..706a64a99ac 100644
--- a/src/test/compile-fail/obsolete-syntax.rs
+++ b/src/test/compile-fail/obsolete-syntax.rs
@@ -63,4 +63,14 @@ fn obsolete_moves() {
     //~^ ERROR obsolete syntax: binary move
 }
 
+extern mod obsolete_name {
+    //~^ ERROR obsolete syntax: named external module
+    fn bar();
+}
+
+pub extern {
+    //~^ ERROR obsolete syntax: `pub extern`
+    pub fn bar();
+}
+
 fn main() { }