ViewPathSimple(binding, ref full_path, id) => {
let source_name =
full_path.segments.last().unwrap().identifier.name;
- if token::get_name(source_name).get() == "mod" {
+ if token::get_name(source_name).get() == "mod" ||
+ token::get_name(source_name).get() == "self" {
self.resolve_error(view_path.span,
- "`mod` imports are only allowed within a { } list");
+ "`self` imports are only allowed within a { } list");
}
let subclass = SingleImport(binding.name,
}).collect::<Vec<Span>>();
if mod_spans.len() > 1 {
self.resolve_error(mod_spans[0],
- "`mod` import can only appear once in the list");
+ "`self` import can only appear once in the list");
for other_span in mod_spans.iter().skip(1) {
self.session.span_note(*other_span,
- "another `mod` import appears here");
+ "another `self` import appears here");
}
}
Some(name) => *name,
None => {
self.resolve_error(source_item.span,
- "`mod` import can only appear in an import list \
+ "`self` import can only appear in an import list \
with a non-empty prefix");
continue;
}
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();