about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2014-12-31 17:24:42 +1300
committerNick Cameron <ncameron@mozilla.com>2015-01-02 23:05:22 +1300
commit74d11d26f4042ce04c56edfd6caafa003383147d (patch)
tree5ebb81f029eeed8ea0ff4d9c492cc718dc43316f /src/libsyntax/parse/parser.rs
parentee3c5957eaaf577bff895ce819447f7e40558a28 (diff)
downloadrust-74d11d26f4042ce04c56edfd6caafa003383147d.tar.gz
rust-74d11d26f4042ce04c56edfd6caafa003383147d.zip
Accept `self` in place of `mod` in use items
[breaking-change]

`mod` is still accepted, but gives a deprecated warning
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 457085f5cc8..f84ddcf360e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -546,6 +546,10 @@ impl<'a> Parser<'a> {
     pub fn parse_path_list_item(&mut self) -> ast::PathListItem {
         let lo = self.span.lo;
         let node = if self.eat_keyword(keywords::Mod) {
+            let span = self.last_span;
+            self.span_warn(span, "deprecated syntax; use the `self` keyword now");
+            ast::PathListMod { id: ast::DUMMY_NODE_ID }
+        } else if self.eat_keyword(keywords::Self) {
             ast::PathListMod { id: ast::DUMMY_NODE_ID }
         } else {
             let ident = self.parse_ident();