diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2015-09-14 01:24:27 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2015-09-17 14:13:13 +0300 |
| commit | 357982fae4ac7be0f6e0065399606f2d78618aaf (patch) | |
| tree | 89dc7fc6e4b4d80d1dcba57bc114ea63e6352eb5 | |
| parent | 50e42ea9f70361ccd71682070c01ea808891f0ce (diff) | |
| download | rust-357982fae4ac7be0f6e0065399606f2d78618aaf.tar.gz rust-357982fae4ac7be0f6e0065399606f2d78618aaf.zip | |
Workaround for imports with empty braces
| -rw-r--r-- | src/librustc_front/visit.rs | 4 | ||||
| -rw-r--r-- | src/librustc_privacy/lib.rs | 10 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-28075.rs | 5 |
5 files changed, 13 insertions, 11 deletions
diff --git a/src/librustc_front/visit.rs b/src/librustc_front/visit.rs index 89c9818efbf..12a20a8d21f 100644 --- a/src/librustc_front/visit.rs +++ b/src/librustc_front/visit.rs @@ -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); } } } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 1a07877066e..817fd984708 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -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); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 6eabf5d69a2..774d13966bd 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -201,7 +201,6 @@ #![feature(alloc)] #![feature(allow_internal_unstable)] -#![feature(arc_weak)] #![feature(associated_consts)] #![feature(borrow_state)] #![feature(box_syntax)] diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 2a2f5c0f2c1..cda750c5cda 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -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); } } } diff --git a/src/test/compile-fail/issue-28075.rs b/src/test/compile-fail/issue-28075.rs index 74a241e819f..7e9dfcf3ccb 100644 --- a/src/test/compile-fail/issue-28075.rs +++ b/src/test/compile-fail/issue-28075.rs @@ -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() { } |
