Workaround for imports with empty braces

This commit is contained in:
Vadim Petrochenkov 2015-09-14 01:24:27 +03:00
parent 50e42ea9f7
commit 357982fae4
5 changed files with 13 additions and 11 deletions

View file

@ -218,8 +218,8 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
visitor.visit_path_list_item(prefix, item)
}
} else {
// FIXME: uncomment this and fix the resulting ICE
// visitor.visit_path(prefix, item.id);
// FIXME(#28388) visit_path should be used instead of walk_path
walk_path(visitor, prefix);
}
}
}

View file

@ -980,15 +980,19 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
}
fn visit_path(&mut self, path: &hir::Path, id: ast::NodeId) {
self.check_path(path.span, id, path.segments.last().unwrap().identifier.name);
visit::walk_path(self, path);
if !path.segments.is_empty() {
self.check_path(path.span, id, path.segments.last().unwrap().identifier.name);
visit::walk_path(self, path);
}
}
fn visit_path_list_item(&mut self, prefix: &hir::Path, item: &hir::PathListItem) {
let name = if let hir::PathListIdent { name, .. } = item.node {
name.name
} else {
} else if !prefix.segments.is_empty() {
prefix.segments.last().unwrap().identifier.name
} else {
self.tcx.sess.bug("`self` import in an import list with empty prefix");
};
self.check_path(item.span, item.node.id(), name);
visit::walk_path_list_item(self, prefix, item);

View file

@ -201,7 +201,6 @@
#![feature(alloc)]
#![feature(allow_internal_unstable)]
#![feature(arc_weak)]
#![feature(associated_consts)]
#![feature(borrow_state)]
#![feature(box_syntax)]

View file

@ -224,8 +224,8 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
visitor.visit_path_list_item(prefix, item)
}
} else {
// FIXME: uncomment this and fix the resulting ICE
// visitor.visit_path(prefix, item.id);
// FIXME(#28388) visit_path should be used instead of walk_path
walk_path(visitor, prefix);
}
}
}

View file

@ -12,11 +12,10 @@
#![allow(unused_imports)]
use std::thread::{catch_panic, sleep}; //~ ERROR use of unstable library feature 'catch_panic'
//~^ ERROR use of unstable library feature 'thread_sleep'
use std::thread::{catch_panic, ScopedKey}; //~ ERROR use of unstable library feature 'catch_panic'
//~^ ERROR use of unstable library feature 'scoped_tls'
use std::rt::{self}; //~ ERROR use of unstable library feature 'rt'
use std::rt::{};
fn main() {
}