Accept self in place of mod in use items

[breaking-change]

`mod` is still accepted, but gives a deprecated warning
This commit is contained in:
Nick Cameron
2014-12-31 17:24:42 +13:00
parent ee3c5957ea
commit 74d11d26f4
4 changed files with 12 additions and 6 deletions

View File

@@ -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();