From bf9f60ac00831cce8f58876e4876f7f02433fd29 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Sun, 6 Mar 2016 09:04:18 +0000 Subject: [PATCH 1/8] Allow glob imports to be shadowed by items and single imports. --- src/librustc_resolve/resolve_imports.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index ff684d37653cb..b5287c2b3fb42 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -213,14 +213,8 @@ impl<'a> NameResolution<'a> { None => return, }; + if !binding.defined_with(DefModifiers::GLOB_IMPORTED) { return } for duplicate_glob in self.duplicate_globs.iter() { - // FIXME #31337: We currently allow items to shadow glob-imported re-exports. - if !binding.is_import() { - if let NameBindingKind::Import { binding, .. } = duplicate_glob.kind { - if binding.is_import() { continue } - } - } - report(duplicate_glob, binding); } } From 4712d18f940f147705e298103ffd121d9bc6d8a2 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Tue, 8 Mar 2016 09:47:52 +0000 Subject: [PATCH 2/8] Allow multiple glob imports of the same item. --- src/librustc_resolve/resolve_imports.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index b5287c2b3fb42..0b3851321b05a 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -143,10 +143,18 @@ impl<'a> NameResolution<'a> { fn try_define(&mut self, binding: &'a NameBinding<'a>) -> Result<(), &'a NameBinding<'a>> { if let Some(old_binding) = self.binding { if binding.defined_with(DefModifiers::GLOB_IMPORTED) { - self.duplicate_globs.push(binding); + if binding.def().unwrap() != old_binding.def().unwrap() { + self.duplicate_globs.push(binding); + } else if old_binding.defined_with(DefModifiers::GLOB_IMPORTED) && + old_binding.is_public() < binding.is_public() { + // We are glob-importing the same item but with greater visibility. + self.binding = Some(binding); + } } else if old_binding.defined_with(DefModifiers::GLOB_IMPORTED) { - self.duplicate_globs.push(old_binding); self.binding = Some(binding); + if binding.def().unwrap() != old_binding.def().unwrap() { + self.duplicate_globs.push(old_binding); + } } else { return Err(old_binding); } @@ -315,11 +323,7 @@ impl<'a> ::ModuleS<'a> { // where it might end up getting re-defined via a glob cycle. let (new_binding, t) = { let mut resolution = &mut *self.resolution(name, ns).borrow_mut(); - let was_known = resolution.binding().is_some(); - let t = update(resolution); - - if was_known { return t; } match resolution.binding() { Some(binding) => (binding, t), None => return t, From 3e34771300ff662706a281b2c7e142862d668b25 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Fri, 11 Mar 2016 02:27:54 +0000 Subject: [PATCH 3/8] Allow unused ambiguous glob imports. --- src/librustc_resolve/resolve_imports.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 0b3851321b05a..8df652a83b19c 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -215,16 +215,15 @@ impl<'a> NameResolution<'a> { self.binding.map(Success) } - fn report_conflicts(&self, mut report: F) { + fn report_conflicts(&mut self, mut _report: F) { let binding = match self.binding { Some(binding) => binding, None => return, }; if !binding.defined_with(DefModifiers::GLOB_IMPORTED) { return } - for duplicate_glob in self.duplicate_globs.iter() { - report(duplicate_glob, binding); - } + let binding = &mut self.binding; + self.duplicate_globs.iter().next().map(|_| *binding = None); } } @@ -686,7 +685,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { let mut reexports = Vec::new(); for (&(name, ns), resolution) in module.resolutions.borrow().iter() { - let resolution = resolution.borrow(); + let mut resolution = resolution.borrow_mut(); resolution.report_conflicts(|b1, b2| { self.resolver.report_conflict(module, name, ns, b1, b2) }); From 4a3adf974bdd73a2297df6e7f484bde49908e632 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Thu, 10 Mar 2016 06:13:06 +0000 Subject: [PATCH 4/8] Make all visible items glob importable. --- src/librustc_resolve/resolve_imports.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 8df652a83b19c..e38ab0f8a216d 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -72,7 +72,7 @@ impl<'a> ImportDirective<'a> { // this returns the binding for the name this directive defines in that namespace. fn import(&self, binding: &'a NameBinding<'a>, privacy_error: Option>>) -> NameBinding<'a> { - let mut modifiers = match self.is_public { + let mut modifiers = match self.is_public && binding.is_public() { true => DefModifiers::PUBLIC | DefModifiers::IMPORTABLE, false => DefModifiers::empty(), }; @@ -334,9 +334,11 @@ impl<'a> ::ModuleS<'a> { } fn define_in_glob_importers(&self, name: Name, ns: Namespace, binding: &'a NameBinding<'a>) { - if !binding.defined_with(DefModifiers::PUBLIC | DefModifiers::IMPORTABLE) { return } + if !binding.defined_with(DefModifiers::IMPORTABLE) { return } for &(importer, directive) in self.glob_importers.borrow_mut().iter() { - let _ = importer.try_define_child(name, ns, directive.import(binding, None)); + if binding.is_public() || self.is_ancestor_of(importer) { + let _ = importer.try_define_child(name, ns, directive.import(binding, None)); + } } } } @@ -658,8 +660,10 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { let bindings = target_module.resolutions.borrow().iter().filter_map(|(name, resolution)| { resolution.borrow().binding().map(|binding| (*name, binding)) }).collect::>(); + let allow_private_names = target_module.is_ancestor_of(module_); for ((name, ns), binding) in bindings { - if binding.defined_with(DefModifiers::IMPORTABLE | DefModifiers::PUBLIC) { + if !binding.defined_with(DefModifiers::IMPORTABLE) { continue } + if allow_private_names || binding.is_public() { let _ = module_.try_define_child(name, ns, directive.import(binding, None)); } } From 573c1d5c21866ff72aed1feed2fd0fb390e72866 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Thu, 10 Mar 2016 06:13:06 +0000 Subject: [PATCH 5/8] Treat private imports like private items. --- src/librustc_resolve/lib.rs | 5 ++++- src/librustc_resolve/resolve_imports.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 5f4244caa629c..5b287ab85ecf2 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1548,7 +1548,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { match use_lexical_scope { true => module.resolve_name_in_lexical_scope(name, namespace) .map(Success).unwrap_or(Failed(None)), - false => module.resolve_name(name, namespace, false), + false => { + let allow_private_imports = module.is_ancestor_of(self.current_module); + module.resolve_name(name, namespace, allow_private_imports) + } }.and_then(|binding| { if record_used { self.record_use(name, namespace, binding); diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index e38ab0f8a216d..71f9ee02999d6 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -74,7 +74,7 @@ impl<'a> ImportDirective<'a> { -> NameBinding<'a> { let mut modifiers = match self.is_public && binding.is_public() { true => DefModifiers::PUBLIC | DefModifiers::IMPORTABLE, - false => DefModifiers::empty(), + false => DefModifiers::IMPORTABLE, }; if let GlobImport = self.subclass { modifiers = modifiers | DefModifiers::GLOB_IMPORTED; From 87403b87c6420f4b06c140d0a65af5e214323edc Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Tue, 15 Mar 2016 00:12:18 +0000 Subject: [PATCH 6/8] Make `pub` single imports of private extern crates public. --- src/librustc_resolve/resolve_imports.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 71f9ee02999d6..7677053b76aba 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -78,6 +78,9 @@ impl<'a> ImportDirective<'a> { }; if let GlobImport = self.subclass { modifiers = modifiers | DefModifiers::GLOB_IMPORTED; + } else if self.is_public && binding.is_extern_crate() { + // `pub` single imports of private extern crates are public (see #31362). + modifiers = modifiers | DefModifiers::PUBLIC; } NameBinding { From 5896b67292696a0bcf9f28f3f90b84a7d0862269 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Thu, 10 Mar 2016 07:35:40 +0000 Subject: [PATCH 7/8] Fix fallout in the compiler (newly unused glob imports). --- src/libcore/hash/mod.rs | 1 + src/libcoretest/num/flt2dec/strategy/dragon.rs | 1 + src/libcoretest/num/flt2dec/strategy/grisu.rs | 1 + src/librustc/hir/map/collector.rs | 2 ++ src/librustc_mir/hair/cx/expr.rs | 1 + src/librustc_mir/hair/cx/mod.rs | 1 + src/librustc_mir/hair/cx/pattern.rs | 1 + src/libstd/ascii.rs | 1 + src/libstd/env.rs | 1 + src/libstd/net/addr.rs | 1 + src/libstd/net/ip.rs | 1 + src/libstd/net/tcp.rs | 1 + src/libstd/net/udp.rs | 1 + src/libstd/sys/common/io.rs | 2 ++ src/libstd/sys/unix/ext/net.rs | 1 + src/libstd/sys/unix/process.rs | 1 + 16 files changed, 18 insertions(+) diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index 4d0fed9833436..e07a09bc74737 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -249,6 +249,7 @@ impl Default for BuildHasherDefault { ////////////////////////////////////////////////////////////////////////////// mod impls { + #[allow(unused_imports)] use prelude::v1::*; use mem; diff --git a/src/libcoretest/num/flt2dec/strategy/dragon.rs b/src/libcoretest/num/flt2dec/strategy/dragon.rs index 79dcca7671a2d..c8eaebf9477a4 100644 --- a/src/libcoretest/num/flt2dec/strategy/dragon.rs +++ b/src/libcoretest/num/flt2dec/strategy/dragon.rs @@ -11,6 +11,7 @@ use std::prelude::v1::*; use std::{i16, f64}; use super::super::*; +#[allow(unused_imports)] use core::num::flt2dec::*; use core::num::bignum::Big32x40 as Big; use core::num::flt2dec::strategy::dragon::*; diff --git a/src/libcoretest/num/flt2dec/strategy/grisu.rs b/src/libcoretest/num/flt2dec/strategy/grisu.rs index 2d4afceda191f..a599b7d1b0c0a 100644 --- a/src/libcoretest/num/flt2dec/strategy/grisu.rs +++ b/src/libcoretest/num/flt2dec/strategy/grisu.rs @@ -10,6 +10,7 @@ use std::{i16, f64}; use super::super::*; +#[allow(unused_imports)] use core::num::flt2dec::*; use core::num::flt2dec::strategy::grisu::*; diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 94fa393ae3df8..49d5b8c7a783f 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -9,8 +9,10 @@ // except according to those terms. use super::*; +#[allow(unused_imports)] use super::MapEntry::*; +#[allow(unused_imports)] use hir::*; use hir::intravisit::Visitor; use hir::def_id::{CRATE_DEF_INDEX, DefId, DefIndex}; diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 12dcb32da3fcd..14f0fc342f302 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -21,6 +21,7 @@ use rustc_const_eval as const_eval; use rustc::middle::region::CodeExtent; use rustc::hir::pat_util; use rustc::ty::{self, VariantDef, Ty}; +#[allow(unused_imports)] use rustc::mir::repr::*; use rustc::hir; use syntax::ptr::P; diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index c3a5fbd967c84..de84aa93e47d8 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -16,6 +16,7 @@ */ use hair::*; +#[allow(unused_imports)] use rustc::mir::repr::*; use rustc::middle::const_val::ConstVal; diff --git a/src/librustc_mir/hair/cx/pattern.rs b/src/librustc_mir/hair/cx/pattern.rs index 990ba9e786c30..7a28c08cf2889 100644 --- a/src/librustc_mir/hair/cx/pattern.rs +++ b/src/librustc_mir/hair/cx/pattern.rs @@ -15,6 +15,7 @@ use rustc_const_eval as const_eval; use rustc::hir::def::Def; use rustc::hir::pat_util::{pat_is_resolved_const, pat_is_binding}; use rustc::ty::{self, Ty}; +#[allow(unused_imports)] use rustc::mir::repr::*; use rustc::hir::{self, PatKind}; use syntax::ast; diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 0db91034eb5ac..fba0b4d9185cc 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -450,6 +450,7 @@ static ASCII_UPPERCASE_MAP: [u8; 256] = [ #[cfg(test)] mod tests { + #[allow(unused_imports)] use prelude::v1::*; use super::*; use char::from_u32; diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 9dc6a26cdeed3..258f809a324f2 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -901,6 +901,7 @@ mod arch { #[cfg(test)] mod tests { + #[allow(unused_imports)] use prelude::v1::*; use super::*; diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index d510339f1c5b4..1b403c8f214b4 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -525,6 +525,7 @@ impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T { #[cfg(test)] mod tests { + #[allow(unused_imports)] use prelude::v1::*; use net::*; use net::test::{tsa, sa6, sa4}; diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index adceee6d73ec5..cc0d658f182de 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -579,6 +579,7 @@ impl From<[u8; 16]> for Ipv6Addr { // Tests for this module #[cfg(test)] mod tests { + #[allow(unused_imports)] use prelude::v1::*; use net::*; use net::Ipv6MulticastScope::*; diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 38da74b89039b..7ee696d067ed2 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -454,6 +454,7 @@ impl fmt::Debug for TcpListener { #[cfg(test)] mod tests { + #[allow(unused_imports)] use prelude::v1::*; use io::ErrorKind; diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index 0be9f13e81761..f5687c5263d52 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -378,6 +378,7 @@ impl fmt::Debug for UdpSocket { #[cfg(test)] mod tests { + #[allow(unused_imports)] use prelude::v1::*; use io::ErrorKind; diff --git a/src/libstd/sys/common/io.rs b/src/libstd/sys/common/io.rs index 7b08852ba51d1..e886df6139451 100644 --- a/src/libstd/sys/common/io.rs +++ b/src/libstd/sys/common/io.rs @@ -93,7 +93,9 @@ pub mod test { #[cfg(test)] mod tests { + #[allow(unused_imports)] use prelude::v1::*; + #[allow(unused_imports)] use io::prelude::*; use super::*; use io; diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index a74f7ea13b415..87dda876023cf 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -731,6 +731,7 @@ impl IntoRawFd for UnixDatagram { #[cfg(test)] mod test { + #[allow(unused_imports)] use prelude::v1::*; use thread; use io; diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index 270c2096b2c3b..2d0e41f5fea82 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -598,6 +598,7 @@ impl Process { #[cfg(test)] mod tests { use super::*; + #[allow(unused_imports)] use prelude::v1::*; use ffi::OsStr; From 1402963749f511b162033a0b23f78f591268402b Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Thu, 10 Mar 2016 07:55:12 +0000 Subject: [PATCH 8/8] Fix fallout in tests. --- src/test/auxiliary/issue_12612_1.rs | 2 +- src/test/compile-fail/glob-cycles.rs | 26 ----------------- src/test/compile-fail/import-shadow-1.rs | 8 ++---- src/test/compile-fail/import-shadow-2.rs | 30 -------------------- src/test/compile-fail/import-shadow-3.rs | 30 -------------------- src/test/compile-fail/import-shadow-4.rs | 30 -------------------- src/test/compile-fail/import-shadow-5.rs | 30 -------------------- src/test/compile-fail/import-shadow-6.rs | 30 -------------------- src/test/compile-fail/import-shadow-7.rs | 30 -------------------- src/test/compile-fail/issue-12612.rs | 3 +- src/test/compile-fail/issue-1697.rs | 2 +- src/test/compile-fail/issue-32797.rs | 21 -------------- src/test/compile-fail/variant-namespacing.rs | 4 +-- 13 files changed, 8 insertions(+), 238 deletions(-) delete mode 100644 src/test/compile-fail/glob-cycles.rs delete mode 100644 src/test/compile-fail/import-shadow-2.rs delete mode 100644 src/test/compile-fail/import-shadow-3.rs delete mode 100644 src/test/compile-fail/import-shadow-4.rs delete mode 100644 src/test/compile-fail/import-shadow-5.rs delete mode 100644 src/test/compile-fail/import-shadow-6.rs delete mode 100644 src/test/compile-fail/import-shadow-7.rs delete mode 100644 src/test/compile-fail/issue-32797.rs diff --git a/src/test/auxiliary/issue_12612_1.rs b/src/test/auxiliary/issue_12612_1.rs index a0234c1185a97..b76df6fe283f7 100644 --- a/src/test/auxiliary/issue_12612_1.rs +++ b/src/test/auxiliary/issue_12612_1.rs @@ -9,5 +9,5 @@ // except according to those terms. pub mod bar { - pub fn foo() {} + fn foo() {} } diff --git a/src/test/compile-fail/glob-cycles.rs b/src/test/compile-fail/glob-cycles.rs deleted file mode 100644 index 077ae19b4cbd6..0000000000000 --- a/src/test/compile-fail/glob-cycles.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -mod foo { - pub use bar::*; - pub use main as f; //~ ERROR has already been imported -} - -mod bar { - pub use foo::*; -} - -pub use foo::*; -pub use baz::*; //~ ERROR has already been imported -mod baz { - pub use super::*; -} - -pub fn main() {} diff --git a/src/test/compile-fail/import-shadow-1.rs b/src/test/compile-fail/import-shadow-1.rs index 503fa4eca527b..697232168123d 100644 --- a/src/test/compile-fail/import-shadow-1.rs +++ b/src/test/compile-fail/import-shadow-1.rs @@ -13,7 +13,7 @@ #![no_implicit_prelude] use foo::*; -use bar::*; //~ERROR a type named `Baz` has already been imported in this module +use bar::*; mod foo { pub type Baz = isize; @@ -23,8 +23,6 @@ mod bar { pub type Baz = isize; } -mod qux { - pub use bar::Baz; +fn main() { + Baz; //~ ERROR } - -fn main() {} diff --git a/src/test/compile-fail/import-shadow-2.rs b/src/test/compile-fail/import-shadow-2.rs deleted file mode 100644 index 0c107cf27f592..0000000000000 --- a/src/test/compile-fail/import-shadow-2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that import shadowing using globs causes errors - -#![no_implicit_prelude] - -use foo::*; -use foo::*; //~ERROR a type named `Baz` has already been imported in this module - -mod foo { - pub type Baz = isize; -} - -mod bar { - pub type Baz = isize; -} - -mod qux { - pub use bar::Baz; -} - -fn main() {} diff --git a/src/test/compile-fail/import-shadow-3.rs b/src/test/compile-fail/import-shadow-3.rs deleted file mode 100644 index bf90973c2857e..0000000000000 --- a/src/test/compile-fail/import-shadow-3.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that import shadowing using globs causes errors - -#![no_implicit_prelude] - -use foo::Baz; -use bar::*; //~ERROR a type named `Baz` has already been imported in this module - -mod foo { - pub type Baz = isize; -} - -mod bar { - pub type Baz = isize; -} - -mod qux { - pub use bar::Baz; -} - -fn main() {} diff --git a/src/test/compile-fail/import-shadow-4.rs b/src/test/compile-fail/import-shadow-4.rs deleted file mode 100644 index f21fdaae47ba0..0000000000000 --- a/src/test/compile-fail/import-shadow-4.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that import shadowing using globs causes errors - -#![no_implicit_prelude] - -use foo::*; -use bar::Baz; //~ERROR a type named `Baz` has already been imported in this module - -mod foo { - pub type Baz = isize; -} - -mod bar { - pub type Baz = isize; -} - -mod qux { - pub use bar::Baz; -} - -fn main() {} diff --git a/src/test/compile-fail/import-shadow-5.rs b/src/test/compile-fail/import-shadow-5.rs deleted file mode 100644 index dc300bc7baa77..0000000000000 --- a/src/test/compile-fail/import-shadow-5.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that import shadowing using globs causes errors - -#![no_implicit_prelude] - -use foo::Baz; -use bar::Baz; //~ERROR a type named `Baz` has already been imported in this module - -mod foo { - pub type Baz = isize; -} - -mod bar { - pub type Baz = isize; -} - -mod qux { - pub use bar::Baz; -} - -fn main() {} diff --git a/src/test/compile-fail/import-shadow-6.rs b/src/test/compile-fail/import-shadow-6.rs deleted file mode 100644 index fa3b75c70f0b6..0000000000000 --- a/src/test/compile-fail/import-shadow-6.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that import shadowing using globs causes errors - -#![no_implicit_prelude] - -use qux::*; -use foo::*; //~ERROR a type named `Baz` has already been imported in this module - -mod foo { - pub type Baz = isize; -} - -mod bar { - pub type Baz = isize; -} - -mod qux { - pub use bar::Baz; -} - -fn main() {} diff --git a/src/test/compile-fail/import-shadow-7.rs b/src/test/compile-fail/import-shadow-7.rs deleted file mode 100644 index 34aba15b39228..0000000000000 --- a/src/test/compile-fail/import-shadow-7.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that import shadowing using globs causes errors - -#![no_implicit_prelude] - -use foo::*; -use qux::*; //~ERROR a type named `Baz` has already been imported in this module - -mod foo { - pub type Baz = isize; -} - -mod bar { - pub type Baz = isize; -} - -mod qux { - pub use bar::Baz; -} - -fn main() {} diff --git a/src/test/compile-fail/issue-12612.rs b/src/test/compile-fail/issue-12612.rs index f76d12d93fdf6..9214feb819a23 100644 --- a/src/test/compile-fail/issue-12612.rs +++ b/src/test/compile-fail/issue-12612.rs @@ -15,8 +15,7 @@ extern crate issue_12612_1 as foo; use foo::bar; mod test { - use bar::foo; - //~^ ERROR unresolved import `bar::foo`. Maybe a missing `extern crate bar`? + use bar::foo; //~ ERROR `foo` is private } fn main() {} diff --git a/src/test/compile-fail/issue-1697.rs b/src/test/compile-fail/issue-1697.rs index f2d858391cea2..c820cc6a9f0b9 100644 --- a/src/test/compile-fail/issue-1697.rs +++ b/src/test/compile-fail/issue-1697.rs @@ -10,6 +10,6 @@ // Testing that we don't fail abnormally after hitting the errors -use unresolved::*; //~ ERROR unresolved import `unresolved::*`. Maybe a missing `extern crate unres +use unresolved::*; //~ ERROR unresolved import fn main() {} diff --git a/src/test/compile-fail/issue-32797.rs b/src/test/compile-fail/issue-32797.rs deleted file mode 100644 index af75783a710b5..0000000000000 --- a/src/test/compile-fail/issue-32797.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub use bar::*; -mod bar { - pub use super::*; -} - -pub use baz::*; //~ ERROR already been imported -mod baz { - pub use main as f; -} - -pub fn main() {} diff --git a/src/test/compile-fail/variant-namespacing.rs b/src/test/compile-fail/variant-namespacing.rs index a8bb94b78fcc0..d658d5292e831 100644 --- a/src/test/compile-fail/variant-namespacing.rs +++ b/src/test/compile-fail/variant-namespacing.rs @@ -31,14 +31,14 @@ const XTuple: u8 = 0; const XUnit: u8 = 0; extern crate variant_namespacing; -pub use variant_namespacing::XE::*; +pub use variant_namespacing::XE::{XStruct, XTuple, XUnit}; //~^ ERROR `XStruct` has already been defined //~| ERROR `XStruct` has already been defined //~| ERROR `XTuple` has already been defined //~| ERROR `XTuple` has already been defined //~| ERROR `XUnit` has already been defined //~| ERROR `XUnit` has already been defined -pub use E::*; +pub use E::{Struct, Tuple, Unit}; //~^ ERROR `Struct` has already been defined //~| ERROR `Struct` has already been defined //~| ERROR `Tuple` has already been defined