diff --git a/src/libcoretest/num/flt2dec/strategy/dragon.rs b/src/libcoretest/num/flt2dec/strategy/dragon.rs index 79dcca7671a2d..08c2cd0a7326f 100644 --- a/src/libcoretest/num/flt2dec/strategy/dragon.rs +++ b/src/libcoretest/num/flt2dec/strategy/dragon.rs @@ -11,7 +11,6 @@ use std::prelude::v1::*; use std::{i16, f64}; use super::super::*; -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..311bd252353c7 100644 --- a/src/libcoretest/num/flt2dec/strategy/grisu.rs +++ b/src/libcoretest/num/flt2dec/strategy/grisu.rs @@ -10,7 +10,6 @@ use std::{i16, f64}; use super::super::*; -use core::num::flt2dec::*; use core::num::flt2dec::strategy::grisu::*; #[test] diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 51a378a08336e..89217e83ca22e 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -9,9 +9,7 @@ // except according to those terms. use super::*; -use super::MapEntry::*; -use hir::*; use hir::intravisit::Visitor; use hir::def_id::DefId; use middle::cstore::InlinedItem; diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index 421843a7f11d8..c61846182bf4a 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use super::*; +use hir::map::definitions::*; use hir; use hir::intravisit; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 8c0d70c6d602b..0942ce79a6b49 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -33,6 +33,7 @@ #![feature(core_intrinsics)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(enumset)] +#![cfg_attr(stage0, feature(item_like_imports))] #![feature(libc)] #![feature(nonzero)] #![feature(quote)] diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 24c1ca574a01b..8a434cdff17e1 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -21,7 +21,6 @@ use rustc_const_eval as const_eval; use rustc::middle::region::CodeExtent; use rustc::ty::{self, AdtKind, VariantDef, Ty}; use rustc::ty::cast::CastKind as TyCastKind; -use rustc::mir::*; 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 038300068fce1..7c4a820223735 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -16,7 +16,6 @@ */ use hair::*; -use rustc::mir::*; use rustc::mir::transform::MirSource; use rustc::middle::const_val::ConstVal; diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index aa56daf888944..62e405564dbb7 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -23,6 +23,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(associated_consts)] #![feature(box_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] +#![cfg_attr(stage0, feature(item_like_imports))] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 627c72ff8c925..6209f08ef2895 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -582,7 +582,7 @@ impl<'b> Resolver<'b> { }); } else { for (name, span) in legacy_imports.imports { - let result = self.resolve_name_in_module(module, name, MacroNS, false, false, None); + let result = self.resolve_name_in_module(module, name, MacroNS, false, None); if let Success(binding) = result { self.legacy_import_macro(name, binding, span, allow_shadowing); } else { @@ -592,7 +592,7 @@ impl<'b> Resolver<'b> { } for (name, span) in legacy_imports.reexports { self.used_crates.insert(module.def_id().unwrap().krate); - let result = self.resolve_name_in_module(module, name, MacroNS, false, false, None); + let result = self.resolve_name_in_module(module, name, MacroNS, false, None); if let Success(binding) = result { self.macro_exports.push(Export { name: name, def: binding.def() }); } else { diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 5eb269030a004..d54f4e7b20c7a 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -59,7 +59,7 @@ items under a new local name. An example of this error: -```compile_fail +```ignore use foo::baz; use bar::*; // error, do `use foo::baz as quux` instead on the previous line diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index a3a60e4f6d754..2bdfe734cf417 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1131,7 +1131,6 @@ pub struct Resolver<'a> { arenas: &'a ResolverArenas<'a>, dummy_binding: &'a NameBinding<'a>, - new_import_semantics: bool, // true if `#![feature(item_like_imports)]` use_extern_macros: bool, // true if `#![feature(use_extern_macros)]` pub exported_macros: Vec, @@ -1333,7 +1332,6 @@ impl<'a> Resolver<'a> { span: DUMMY_SP, vis: ty::Visibility::Public, }), - new_import_semantics: session.features.borrow().item_like_imports, use_extern_macros: session.features.borrow().use_extern_macros, exported_macros: Vec::new(), @@ -1442,7 +1440,7 @@ impl<'a> Resolver<'a> { -> ResolveResult> { fn search_parent_externals<'a>(this: &mut Resolver<'a>, needle: Name, module: Module<'a>) -> Option> { - match this.resolve_name_in_module(module, needle, TypeNS, false, false, None) { + match this.resolve_name_in_module(module, needle, TypeNS, false, None) { Success(binding) if binding.is_extern_crate() => Some(module), _ => if let (&ModuleKind::Def(..), Some(parent)) = (&module.kind, module.parent) { search_parent_externals(this, needle, parent) @@ -1460,7 +1458,7 @@ impl<'a> Resolver<'a> { // modules as we go. while index < module_path_len { let name = module_path[index].name; - match self.resolve_name_in_module(search_module, name, TypeNS, false, false, span) { + match self.resolve_name_in_module(search_module, name, TypeNS, false, span) { Failed(_) => { let segment_name = name.as_str(); let module_name = module_to_string(search_module); @@ -1617,7 +1615,7 @@ impl<'a> Resolver<'a> { if let ModuleRibKind(module) = self.ribs[ns][i].kind { let name = ident.name; - let item = self.resolve_name_in_module(module, name, ns, true, false, record_used); + let item = self.resolve_name_in_module(module, name, ns, false, record_used); if let Success(binding) = item { // The ident resolves to an item. return Some(LexicalScopeBinding::Item(binding)); @@ -1626,7 +1624,7 @@ impl<'a> Resolver<'a> { if let ModuleKind::Block(..) = module.kind { // We can see through blocks } else if !module.no_implicit_prelude { return self.prelude.and_then(|prelude| { - self.resolve_name_in_module(prelude, name, ns, false, false, None).success() + self.resolve_name_in_module(prelude, name, ns, false, None).success() }).map(LexicalScopeBinding::Item) } else { return None; @@ -2772,7 +2770,7 @@ impl<'a> Resolver<'a> { }; let name = segments.last().unwrap().identifier.name; - let result = self.resolve_name_in_module(module, name, namespace, false, false, Some(span)); + let result = self.resolve_name_in_module(module, name, namespace, false, Some(span)); result.success().ok_or(false) } @@ -2800,7 +2798,7 @@ impl<'a> Resolver<'a> { }; let name = segments.last().unwrap().ident().name; - let result = self.resolve_name_in_module(module, name, namespace, false, false, Some(span)); + let result = self.resolve_name_in_module(module, name, namespace, false, Some(span)); result.success().ok_or(false) } diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 524d491a464e2..6b385d549a5b8 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -272,7 +272,7 @@ impl<'a> Resolver<'a> { loop { // Since expanded macros may not shadow the lexical scope (enforced below), // we can ignore unresolved invocations (indicated by the penultimate argument). - match self.resolve_name_in_module(module, name, ns, true, true, record_used) { + match self.resolve_name_in_module(module, name, ns, true, record_used) { Success(binding) => { let span = match record_used { Some(span) => span, diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index d0ce1acaadf62..47bd1f71084aa 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -75,7 +75,6 @@ pub struct NameResolution<'a> { single_imports: SingleImports<'a>, /// The least shadowable known binding for this name, or None if there are no known bindings. pub binding: Option<&'a NameBinding<'a>>, - duplicate_globs: Vec<&'a NameBinding<'a>>, } #[derive(Clone, Debug)] @@ -141,7 +140,6 @@ impl<'a> Resolver<'a> { module: Module<'a>, name: Name, ns: Namespace, - allow_private_imports: bool, ignore_unresolved_invocations: bool, record_used: Option) -> ResolveResult<&'a NameBinding<'a>> { @@ -153,18 +151,8 @@ impl<'a> Resolver<'a> { _ => return Failed(None), // This happens when there is a cycle of imports }; - let new_import_semantics = self.new_import_semantics; - let is_disallowed_private_import = |binding: &NameBinding| { - !new_import_semantics && !allow_private_imports && // disallowed - binding.vis != ty::Visibility::Public && binding.is_import() && // non-`pub` import - !binding.is_extern_crate() // not an `extern crate` - }; - if let Some(span) = record_used { if let Some(binding) = resolution.binding { - if is_disallowed_private_import(binding) { - return Failed(None); - } if self.record_use(name, ns, binding, span) { return Success(self.dummy_binding); } @@ -177,9 +165,8 @@ impl<'a> Resolver<'a> { } let check_usable = |this: &mut Self, binding: &'a NameBinding<'a>| { - let usable = - this.is_accessible(binding.vis) && !is_disallowed_private_import(binding) || - binding.is_extern_crate(); // c.f. issue #37020 + // `extern crate` are always usable for backwards compatability, see issue #37020. + let usable = this.is_accessible(binding.vis) || binding.is_extern_crate(); if usable { Success(binding) } else { Failed(None) } }; @@ -202,7 +189,7 @@ impl<'a> Resolver<'a> { SingleImport { source, .. } => source, _ => unreachable!(), }; - match self.resolve_name_in_module(module, name, ns, true, false, None) { + match self.resolve_name_in_module(module, name, ns, false, None) { Failed(_) => {} _ => return Indeterminate, } @@ -224,7 +211,7 @@ impl<'a> Resolver<'a> { for directive in module.globs.borrow().iter() { if self.is_accessible(directive.vis.get()) { if let Some(module) = directive.imported_module.get() { - let result = self.resolve_name_in_module(module, name, ns, true, false, None); + let result = self.resolve_name_in_module(module, name, ns, false, None); if let Indeterminate = result { return Indeterminate; } @@ -311,10 +298,8 @@ impl<'a> Resolver<'a> { self.update_resolution(module, name, ns, |this, resolution| { if let Some(old_binding) = resolution.binding { if binding.is_glob_import() { - if !this.new_import_semantics { - resolution.duplicate_globs.push(binding); - } else if !old_binding.is_glob_import() && - !(ns == MacroNS && old_binding.expansion != Mark::root()) { + if !old_binding.is_glob_import() && + !(ns == MacroNS && old_binding.expansion != Mark::root()) { } else if binding.def() != old_binding.def() { resolution.binding = Some(this.ambiguity(old_binding, binding)); } else if !old_binding.vis.is_at_least(binding.vis, this) { @@ -322,11 +307,8 @@ impl<'a> Resolver<'a> { resolution.binding = Some(binding); } } else if old_binding.is_glob_import() { - if !this.new_import_semantics { - resolution.duplicate_globs.push(old_binding); - resolution.binding = Some(binding); - } else if ns == MacroNS && binding.expansion != Mark::root() && - binding.def() != old_binding.def() { + if ns == MacroNS && binding.expansion != Mark::root() && + binding.def() != old_binding.def() { resolution.binding = Some(this.ambiguity(binding, old_binding)); } else { resolution.binding = Some(binding); @@ -366,7 +348,7 @@ impl<'a> Resolver<'a> { let t = f(self, resolution); match resolution.binding() { - _ if !self.new_import_semantics && old_binding.is_some() => return t, + _ if old_binding.is_some() => return t, None => return t, Some(binding) => match old_binding { Some(old_binding) if old_binding as *const _ == binding as *const _ => return t, @@ -377,10 +359,7 @@ impl<'a> Resolver<'a> { // Define `binding` in `module`s glob importers. for directive in module.glob_importers.borrow_mut().iter() { - if match self.new_import_semantics { - true => self.is_accessible_from(binding.vis, directive.parent), - false => binding.vis == ty::Visibility::Public, - } { + if self.is_accessible_from(binding.vis, directive.parent) { let imported_binding = self.import(binding, directive); let _ = self.try_define(directive.parent, name, ns, imported_binding); } @@ -528,7 +507,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { self.per_ns(|this, ns| { if let Err(Undetermined) = result[ns].get() { result[ns].set({ - match this.resolve_name_in_module(module, source, ns, false, false, None) { + match this.resolve_name_in_module(module, source, ns, false, None) { Success(binding) => Ok(binding), Indeterminate => Err(Undetermined), Failed(_) => Err(Determined), @@ -624,7 +603,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { if all_ns_err { let mut all_ns_failed = true; self.per_ns(|this, ns| { - match this.resolve_name_in_module(module, name, ns, false, false, Some(span)) { + match this.resolve_name_in_module(module, name, ns, false, Some(span)) { Success(_) => all_ns_failed = false, _ => {} } @@ -729,8 +708,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { resolution.borrow().binding().map(|binding| (*name, binding)) }).collect::>(); for ((name, ns), binding) in bindings { - if binding.pseudo_vis() == ty::Visibility::Public || - self.new_import_semantics && self.is_accessible(binding.vis) { + if binding.pseudo_vis() == ty::Visibility::Public || self.is_accessible(binding.vis) { let imported_binding = self.import(binding, directive); let _ = self.try_define(directive.parent, name, ns, imported_binding); } @@ -761,20 +739,6 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { None => continue, }; - // Report conflicts - if !self.new_import_semantics { - for duplicate_glob in resolution.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 } - } - } - - self.report_conflict(module, name, ns, duplicate_glob, binding); - } - } - if binding.vis == ty::Visibility::Public && (binding.is_import() || binding.is_extern_crate()) { let def = binding.def(); diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index ea66fdc31cf08..dbdf56e4d7890 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -284,9 +284,6 @@ declare_features! ( // instead of just the platforms on which it is the C ABI (active, abi_sysv64, "1.13.0", Some(36167)), - // Use the import semantics from RFC 1560. - (active, item_like_imports, "1.13.0", Some(35120)), - // Macros 1.1 (active, proc_macro, "1.13.0", Some(35900)), @@ -362,6 +359,7 @@ declare_features! ( (accepted, question_mark, "1.13.0", Some(31436)), // Allows `..` in tuple (struct) patterns (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)), + (accepted, item_like_imports, "1.14.0", Some(35120)), ); // (changing above list without updating src/doc/reference.md makes @cmr sad) diff --git a/src/test/compile-fail/auxiliary/issue_12612_1.rs b/src/test/compile-fail/auxiliary/issue_12612_1.rs deleted file mode 100644 index a0234c1185a97..0000000000000 --- a/src/test/compile-fail/auxiliary/issue_12612_1.rs +++ /dev/null @@ -1,13 +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. - -pub mod bar { - pub fn foo() {} -} diff --git a/src/test/compile-fail/auxiliary/namespace-mix-old.rs b/src/test/compile-fail/auxiliary/namespace-mix-old.rs deleted file mode 100644 index 29b139d771b0d..0000000000000 --- a/src/test/compile-fail/auxiliary/namespace-mix-old.rs +++ /dev/null @@ -1,83 +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. - -// FIXME: Remove when `item_like_imports` is stabilized. - -pub mod c { - pub struct S {} - pub struct TS(); - pub struct US; - pub enum E { - V {}, - TV(), - UV, - } - - pub struct Item; -} - -pub mod proxy { - pub use c::*; - pub use c::E::*; -} - -pub mod xm1 { - pub use ::proxy::*; - pub type S = ::c::Item; -} -pub mod xm2 { - pub use ::proxy::*; - pub const S: ::c::Item = ::c::Item; -} - -pub mod xm3 { - pub use ::proxy::*; - pub type TS = ::c::Item; -} -pub mod xm4 { - pub use ::proxy::*; - pub const TS: ::c::Item = ::c::Item; -} - -pub mod xm5 { - pub use ::proxy::*; - pub type US = ::c::Item; -} -pub mod xm6 { - pub use ::proxy::*; - pub const US: ::c::Item = ::c::Item; -} - -pub mod xm7 { - pub use ::proxy::*; - pub type V = ::c::Item; -} -pub mod xm8 { - pub use ::proxy::*; - pub const V: ::c::Item = ::c::Item; -} - -pub mod xm9 { - pub use ::proxy::*; - pub type TV = ::c::Item; -} -pub mod xmA { - pub use ::proxy::*; - pub const TV: ::c::Item = ::c::Item; -} - -pub mod xmB { - pub use ::proxy::*; - pub type UV = ::c::Item; -} -pub mod xmC { - pub use ::proxy::*; - pub const UV: ::c::Item = ::c::Item; -} diff --git a/src/test/compile-fail/auxiliary/namespace-mix-new.rs b/src/test/compile-fail/auxiliary/namespace-mix.rs similarity index 97% rename from src/test/compile-fail/auxiliary/namespace-mix-new.rs rename to src/test/compile-fail/auxiliary/namespace-mix.rs index d42c0ee1a4da5..d82e9bb702283 100644 --- a/src/test/compile-fail/auxiliary/namespace-mix-new.rs +++ b/src/test/compile-fail/auxiliary/namespace-mix.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(item_like_imports)] - pub mod c { pub struct S {} pub struct TS(); diff --git a/src/test/compile-fail/glob-cycles.rs b/src/test/compile-fail/glob-cycles.rs index 077ae19b4cbd6..8f1b8ec91db38 100644 --- a/src/test/compile-fail/glob-cycles.rs +++ b/src/test/compile-fail/glob-cycles.rs @@ -8,9 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(rustc_attrs)] + mod foo { pub use bar::*; - pub use main as f; //~ ERROR has already been imported + pub use main as f; } mod bar { @@ -18,9 +20,10 @@ mod bar { } pub use foo::*; -pub use baz::*; //~ ERROR has already been imported +pub use baz::*; mod baz { pub use super::*; } -pub fn main() {} +#[rustc_error] +pub fn main() {} //~ ERROR compilation successful diff --git a/src/test/compile-fail/import-shadow-1.rs b/src/test/compile-fail/import-shadow-1.rs deleted file mode 100644 index 503fa4eca527b..0000000000000 --- a/src/test/compile-fail/import-shadow-1.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::*; //~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-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/import.rs b/src/test/compile-fail/import.rs index 1ca1c060410ad..81a5334ed7ab7 100644 --- a/src/test/compile-fail/import.rs +++ b/src/test/compile-fail/import.rs @@ -20,6 +20,6 @@ mod zed { } fn main() { - zed::foo(); //~ ERROR unresolved name + zed::foo(); //~ ERROR `foo` is private bar(); } diff --git a/src/test/compile-fail/imports/duplicate.rs b/src/test/compile-fail/imports/duplicate.rs index faf85a523e8fb..8dd69d8c24c85 100644 --- a/src/test/compile-fail/imports/duplicate.rs +++ b/src/test/compile-fail/imports/duplicate.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(item_like_imports)] - mod a { pub fn foo() {} } diff --git a/src/test/compile-fail/imports/reexports.rs b/src/test/compile-fail/imports/reexports.rs index fc46b23351adf..65e6e8d01b05f 100644 --- a/src/test/compile-fail/imports/reexports.rs +++ b/src/test/compile-fail/imports/reexports.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(item_like_imports)] - mod a { fn foo() {} mod foo {} diff --git a/src/test/compile-fail/imports/unused.rs b/src/test/compile-fail/imports/unused.rs index 4ec9987df4208..05ecc781af30d 100644 --- a/src/test/compile-fail/imports/unused.rs +++ b/src/test/compile-fail/imports/unused.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(pub_restricted, item_like_imports)] +#![feature(pub_restricted)] #![deny(unused)] mod foo { diff --git a/src/test/compile-fail/issue-12612.rs b/src/test/compile-fail/issue-12612.rs deleted file mode 100644 index c6f76ca78874b..0000000000000 --- a/src/test/compile-fail/issue-12612.rs +++ /dev/null @@ -1,22 +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. - -// aux-build:issue_12612_1.rs - -extern crate issue_12612_1 as foo; - -use foo::bar; - -mod test { - use bar::foo; //~ ERROR unresolved import `bar::foo` [E0432] - //~^ Maybe a missing `extern crate bar;`? -} - -fn main() {} diff --git a/src/test/compile-fail/issue-32797.rs b/src/test/compile-fail/issue-32797.rs index af75783a710b5..2c54ed3e857e9 100644 --- a/src/test/compile-fail/issue-32797.rs +++ b/src/test/compile-fail/issue-32797.rs @@ -8,14 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(rustc_attrs)] + pub use bar::*; mod bar { pub use super::*; } -pub use baz::*; //~ ERROR already been imported +pub use baz::*; mod baz { pub use main as f; } -pub fn main() {} +#[rustc_error] +pub fn main() {} //~ ERROR compilation successful diff --git a/src/test/compile-fail/issue-32833.rs b/src/test/compile-fail/issue-32833.rs index d610e8b483798..41383e93603d3 100644 --- a/src/test/compile-fail/issue-32833.rs +++ b/src/test/compile-fail/issue-32833.rs @@ -11,8 +11,7 @@ use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432] //~^ no `Foo` in `bar` mod bar { - use Foo; //~ ERROR unresolved import `Foo` [E0432] - //~^ no `Foo` in the root + use Foo; } fn main() {} diff --git a/src/test/compile-fail/namespace-mix-old.rs b/src/test/compile-fail/namespace-mix-old.rs deleted file mode 100644 index 8cd82050814a0..0000000000000 --- a/src/test/compile-fail/namespace-mix-old.rs +++ /dev/null @@ -1,172 +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. - -// FIXME: Remove when `item_like_imports` is stabilized. - -// aux-build:namespace-mix-old.rs - -extern crate namespace_mix_old; -use namespace_mix_old::{xm1, xm2, xm3, xm4, xm5, xm6, xm7, xm8, xm9, xmA, xmB, xmC}; - -mod c { - pub struct S {} - pub struct TS(); - pub struct US; - pub enum E { - V {}, - TV(), - UV, - } - - pub struct Item; -} - -mod proxy { - pub use c::*; - pub use c::E::*; -} - -// Use something emitting the type argument name, e.g. unsatisfied bound. -trait Impossible {} -fn check(_: T) {} - -mod m1 { - pub use ::proxy::*; - pub type S = ::c::Item; -} -mod m2 { - pub use ::proxy::*; - pub const S: ::c::Item = ::c::Item; -} - -fn f12() { - check(m1::S{}); //~ ERROR c::Item - check(m1::S); //~ ERROR unresolved name - check(m2::S{}); //~ ERROR c::S - check(m2::S); //~ ERROR c::Item -} -fn xf12() { - check(xm1::S{}); //~ ERROR c::Item - check(xm1::S); //~ ERROR unresolved name - check(xm2::S{}); //~ ERROR c::S - check(xm2::S); //~ ERROR c::Item -} - -mod m3 { - pub use ::proxy::*; - pub type TS = ::c::Item; -} -mod m4 { - pub use ::proxy::*; - pub const TS: ::c::Item = ::c::Item; -} - -fn f34() { - check(m3::TS{}); //~ ERROR c::Item - check(m3::TS); //~ ERROR c::TS - check(m4::TS{}); //~ ERROR c::TS - check(m4::TS); //~ ERROR c::Item -} -fn xf34() { - check(xm3::TS{}); //~ ERROR c::Item - check(xm3::TS); //~ ERROR c::TS - check(xm4::TS{}); //~ ERROR c::TS - check(xm4::TS); //~ ERROR c::Item -} - -mod m5 { - pub use ::proxy::*; - pub type US = ::c::Item; -} -mod m6 { - pub use ::proxy::*; - pub const US: ::c::Item = ::c::Item; -} - -fn f56() { - check(m5::US{}); //~ ERROR c::Item - check(m5::US); //~ ERROR c::US - check(m6::US{}); //~ ERROR c::US - check(m6::US); //~ ERROR c::Item -} -fn xf56() { - check(xm5::US{}); //~ ERROR c::Item - check(xm5::US); //~ ERROR c::US - check(xm6::US{}); //~ ERROR c::US - check(xm6::US); //~ ERROR c::Item -} - -mod m7 { - pub use ::proxy::*; - pub type V = ::c::Item; -} -mod m8 { - pub use ::proxy::*; - pub const V: ::c::Item = ::c::Item; -} - -fn f78() { - check(m7::V{}); //~ ERROR c::Item - check(m7::V); //~ ERROR name of a struct or struct variant - check(m8::V{}); //~ ERROR c::E - check(m8::V); //~ ERROR c::Item -} -fn xf78() { - check(xm7::V{}); //~ ERROR c::Item - check(xm7::V); //~ ERROR name of a struct or struct variant - check(xm8::V{}); //~ ERROR c::E - check(xm8::V); //~ ERROR c::Item -} - -mod m9 { - pub use ::proxy::*; - pub type TV = ::c::Item; -} -mod mA { - pub use ::proxy::*; - pub const TV: ::c::Item = ::c::Item; -} - -fn f9A() { - check(m9::TV{}); //~ ERROR c::Item - check(m9::TV); //~ ERROR c::E - check(mA::TV{}); //~ ERROR c::E - check(mA::TV); //~ ERROR c::Item -} -fn xf9A() { - check(xm9::TV{}); //~ ERROR c::Item - check(xm9::TV); //~ ERROR c::E - check(xmA::TV{}); //~ ERROR c::E - check(xmA::TV); //~ ERROR c::Item -} - -mod mB { - pub use ::proxy::*; - pub type UV = ::c::Item; -} -mod mC { - pub use ::proxy::*; - pub const UV: ::c::Item = ::c::Item; -} - -fn fBC() { - check(mB::UV{}); //~ ERROR c::Item - check(mB::UV); //~ ERROR c::E - check(mC::UV{}); //~ ERROR c::E - check(mC::UV); //~ ERROR c::Item -} -fn xfBC() { - check(xmB::UV{}); //~ ERROR c::Item - check(xmB::UV); //~ ERROR c::E - check(xmC::UV{}); //~ ERROR c::E - check(xmC::UV); //~ ERROR c::Item -} - -fn main() {} diff --git a/src/test/compile-fail/namespace-mix-new.rs b/src/test/compile-fail/namespace-mix.rs similarity index 96% rename from src/test/compile-fail/namespace-mix-new.rs rename to src/test/compile-fail/namespace-mix.rs index 59592e3d737d8..cb7894b726f46 100644 --- a/src/test/compile-fail/namespace-mix-new.rs +++ b/src/test/compile-fail/namespace-mix.rs @@ -8,12 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:namespace-mix-new.rs +// aux-build:namespace-mix.rs -#![feature(item_like_imports)] - -extern crate namespace_mix_new; -use namespace_mix_new::*; +extern crate namespace_mix; +use namespace_mix::*; mod c { pub struct S {} diff --git a/src/test/compile-fail/privacy2.rs b/src/test/compile-fail/privacy2.rs index 376e95312b8fb..113dd28794068 100644 --- a/src/test/compile-fail/privacy2.rs +++ b/src/test/compile-fail/privacy2.rs @@ -31,8 +31,7 @@ fn test1() { fn test2() { use bar::glob::foo; - //~^ ERROR unresolved import `bar::glob::foo` [E0432] - //~| no `foo` in `bar::glob` + //~^ ERROR `foo` is private } #[start] fn main(_: isize, _: *const *const u8) -> isize { 3 } diff --git a/src/test/compile-fail/shadowed-use-visibility.rs b/src/test/compile-fail/shadowed-use-visibility.rs index 1bf7f3933849d..e7e57a73de02f 100644 --- a/src/test/compile-fail/shadowed-use-visibility.rs +++ b/src/test/compile-fail/shadowed-use-visibility.rs @@ -16,11 +16,11 @@ mod foo { } mod bar { - use foo::bar::f as g; //~ ERROR unresolved import + use foo::bar::f as g; //~ ERROR module `bar` is private use foo as f; pub use foo::*; } -use bar::f::f; //~ ERROR unresolved import +use bar::f::f; //~ ERROR module `f` is private fn main() {} diff --git a/src/test/compile-fail/variant-namespacing.rs b/src/test/compile-fail/variant-namespacing.rs index 3d8e2daaa15b1..44e9260770e03 100644 --- a/src/test/compile-fail/variant-namespacing.rs +++ b/src/test/compile-fail/variant-namespacing.rs @@ -31,11 +31,11 @@ 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 `XTuple` 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 `Tuple` has already been defined //~| ERROR `Unit` has already been defined diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs index e750d1fb1e3e6..4e402721a7b39 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs @@ -10,7 +10,7 @@ // force-host -#![feature(plugin_registrar, rustc_private, item_like_imports)] +#![feature(plugin_registrar, rustc_private)] extern crate syntax; extern crate syntax_ext; diff --git a/src/test/run-pass/imports.rs b/src/test/run-pass/imports.rs index 195b99c9788e8..f845a2ee57162 100644 --- a/src/test/run-pass/imports.rs +++ b/src/test/run-pass/imports.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(item_like_imports)] #![allow(unused)] // Like other items, private imports can be imported and used non-lexically in paths.