From 42c3c67d9bd75a3479d78eca5165578339c3b790 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Fri, 21 Nov 2025 21:58:09 +0300 Subject: [PATCH] resolve: Partially convert `ambiguous_glob_imports` lint into a hard error --- .../build_system/src/test.rs | 2 - compiler/rustc_lint_defs/src/builtin.rs | 4 +- .../rustc_resolve/src/build_reduced_graph.rs | 9 +- compiler/rustc_resolve/src/diagnostics.rs | 2 +- compiler/rustc_resolve/src/imports.rs | 182 ++++++++---------- compiler/rustc_resolve/src/lib.rs | 37 +--- tests/ui/imports/ambiguous-1.rs | 6 +- tests/ui/imports/ambiguous-1.stderr | 60 ++---- tests/ui/imports/ambiguous-10.rs | 6 +- tests/ui/imports/ambiguous-10.stderr | 32 +-- tests/ui/imports/ambiguous-12.rs | 5 +- tests/ui/imports/ambiguous-12.stderr | 32 +-- tests/ui/imports/ambiguous-13.rs | 6 +- tests/ui/imports/ambiguous-13.stderr | 32 +-- tests/ui/imports/ambiguous-15.rs | 5 +- tests/ui/imports/ambiguous-15.stderr | 32 +-- tests/ui/imports/ambiguous-16.rs | 5 +- tests/ui/imports/ambiguous-16.stderr | 32 +-- tests/ui/imports/ambiguous-17.rs | 5 +- tests/ui/imports/ambiguous-17.stderr | 44 +---- tests/ui/imports/ambiguous-2.rs | 9 - tests/ui/imports/ambiguous-2.stderr | 49 ----- tests/ui/imports/ambiguous-3.rs | 5 +- tests/ui/imports/ambiguous-3.stderr | 36 +--- tests/ui/imports/ambiguous-4-extern.rs | 6 +- tests/ui/imports/ambiguous-4-extern.stderr | 58 ++---- tests/ui/imports/ambiguous-4.rs | 9 - tests/ui/imports/ambiguous-4.stderr | 49 ----- tests/ui/imports/ambiguous-5.rs | 5 +- tests/ui/imports/ambiguous-5.stderr | 32 +-- tests/ui/imports/ambiguous-6.rs | 5 +- tests/ui/imports/ambiguous-6.stderr | 36 +--- tests/ui/imports/ambiguous-9.rs | 8 +- tests/ui/imports/ambiguous-9.stderr | 90 ++------- .../ui/imports/ambiguous-panic-globvsglob.rs | 5 +- .../imports/ambiguous-panic-globvsglob.stderr | 32 +-- .../ui/imports/glob-conflict-cross-crate-3.rs | 5 +- .../glob-conflict-cross-crate-3.stderr | 55 ++---- .../imports/unresolved-seg-after-ambiguous.rs | 4 +- .../unresolved-seg-after-ambiguous.stderr | 39 +--- 40 files changed, 227 insertions(+), 848 deletions(-) delete mode 100644 tests/ui/imports/ambiguous-2.rs delete mode 100644 tests/ui/imports/ambiguous-2.stderr delete mode 100644 tests/ui/imports/ambiguous-4.rs delete mode 100644 tests/ui/imports/ambiguous-4.stderr diff --git a/compiler/rustc_codegen_gcc/build_system/src/test.rs b/compiler/rustc_codegen_gcc/build_system/src/test.rs index ca2a2a7dc2de0..f1c10681d147c 100644 --- a/compiler/rustc_codegen_gcc/build_system/src/test.rs +++ b/compiler/rustc_codegen_gcc/build_system/src/test.rs @@ -826,8 +826,6 @@ fn valid_ui_error_pattern_test(file: &str) -> bool { "type-alias-impl-trait/auxiliary/cross_crate_ice.rs", "type-alias-impl-trait/auxiliary/cross_crate_ice2.rs", "macros/rfc-2011-nicer-assert-messages/auxiliary/common.rs", - "imports/ambiguous-1.rs", - "imports/ambiguous-4-extern.rs", "entry-point/auxiliary/bad_main_functions.rs", ] .iter() diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index ff108031badc1..0f6f89fbbc0ff 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -4438,7 +4438,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust,compile_fail + /// ```rust,ignore (needs extern crate) /// #![deny(ambiguous_glob_imports)] /// pub fn foo() -> u32 { /// use sub::*; @@ -4454,8 +4454,6 @@ declare_lint! { /// } /// ``` /// - /// {{produces}} - /// /// ### Explanation /// /// Previous versions of Rust compile it successfully because it diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index f0dffd8829da3..726d7dfb54d86 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -54,7 +54,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { decl: Decl<'ra>, ) { if let Err(old_decl) = - self.try_plant_decl_into_local_module(ident, orig_ident_span, ns, decl, false) + self.try_plant_decl_into_local_module(ident, orig_ident_span, ns, decl) { self.report_conflict(ident, ns, old_decl, decl); } @@ -88,13 +88,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { vis: Visibility, span: Span, expansion: LocalExpnId, - ambiguity: Option>, + ambiguity: Option<(Decl<'ra>, bool)>, ) { let decl = self.arenas.alloc_decl(DeclData { kind: DeclKind::Def(res), ambiguity: CmCell::new(ambiguity), - // External ambiguities always report the `AMBIGUOUS_GLOB_IMPORTS` lint at the moment. - warn_ambiguity: CmCell::new(true), vis: CmCell::new(vis), span, expansion, @@ -292,7 +290,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let ModChild { ident: _, res, vis, ref reexport_chain } = *ambig_child; let span = child_span(self, reexport_chain, res); let res = res.expect_non_local(); - self.arenas.new_def_decl(res, vis, span, expansion, Some(parent)) + // External ambiguities always report the `AMBIGUOUS_GLOB_IMPORTS` lint at the moment. + (self.arenas.new_def_decl(res, vis, span, expansion, Some(parent)), true) }); // Record primary definitions. diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 5c401c3bf8280..b3f06fe2da068 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1125,7 +1125,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { .emit() } - fn def_path_str(&self, mut def_id: DefId) -> String { + pub(crate) fn def_path_str(&self, mut def_id: DefId) -> String { // We can't use `def_path_str` in resolve. let mut path = vec![def_id]; while let Some(parent) = self.tcx.opt_parent(def_id) { diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 7ff24bc612dfa..ad796f5c574ba 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -314,7 +314,6 @@ fn remove_same_import<'ra>(d1: Decl<'ra>, d2: Decl<'ra>) -> (Decl<'ra>, Decl<'ra } // Visibility of the new import declaration may be different, // because it already incorporates the visibility of the source binding. - // `warn_ambiguity` of a re-fetched glob can also change in both directions. remove_same_import(d1_next, d2_next) } else { (d1, d2) @@ -344,7 +343,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { self.arenas.alloc_decl(DeclData { kind: DeclKind::Import { source_decl: decl, import }, ambiguity: CmCell::new(None), - warn_ambiguity: CmCell::new(false), span: import.span, vis: CmCell::new(vis), expansion: import.parent_scope.expansion, @@ -352,14 +350,43 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }) } + fn is_noise_0_7_0(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> bool { + let DeclKind::Import { import: i1, .. } = glob_decl.kind else { unreachable!() }; + let DeclKind::Import { import: i2, .. } = old_glob_decl.kind else { unreachable!() }; + let [seg1, seg2] = &i1.module_path[..] else { return false }; + if seg1.ident.name != kw::SelfLower || seg2.ident.name.as_str() != "perlin_surflet" { + return false; + } + let [seg1, seg2] = &i2.module_path[..] else { return false }; + if seg1.ident.name != kw::SelfLower || seg2.ident.name.as_str() != "perlin" { + return false; + } + let Some(def_id1) = glob_decl.res().opt_def_id() else { return false }; + let Some(def_id2) = old_glob_decl.res().opt_def_id() else { return false }; + self.def_path_str(def_id1).ends_with("noise_fns::generators::perlin_surflet::Perlin") + && self.def_path_str(def_id2).ends_with("noise_fns::generators::perlin::Perlin") + } + + fn is_rustybuzz_0_4_0(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> bool { + let DeclKind::Import { import: i1, .. } = glob_decl.kind else { unreachable!() }; + let DeclKind::Import { import: i2, .. } = old_glob_decl.kind else { unreachable!() }; + let [seg1, seg2] = &i1.module_path[..] else { return false }; + if seg1.ident.name != kw::Super || seg2.ident.name.as_str() != "gsubgpos" { + return false; + } + let [seg1] = &i2.module_path[..] else { return false }; + if seg1.ident.name != kw::Super { + return false; + } + let Some(def_id1) = glob_decl.res().opt_def_id() else { return false }; + let Some(def_id2) = old_glob_decl.res().opt_def_id() else { return false }; + self.def_path_str(def_id1).ends_with("tables::gsubgpos::Class") + && self.def_path_str(def_id2).ends_with("ggg::Class") + } + /// If `glob_decl` attempts to overwrite `old_glob_decl` in a module, /// decide which one to keep. - fn select_glob_decl( - &self, - old_glob_decl: Decl<'ra>, - glob_decl: Decl<'ra>, - warn_ambiguity: bool, - ) -> Decl<'ra> { + fn select_glob_decl(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> Decl<'ra> { assert!(glob_decl.is_glob_import()); assert!(old_glob_decl.is_glob_import()); assert_ne!(glob_decl, old_glob_decl); @@ -368,9 +395,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // all these overwrites will be re-fetched by glob imports importing // from that module without generating new ambiguities. // - A glob decl is overwritten by a non-glob decl arriving later. - // - A glob decl is overwritten by its clone after setting ambiguity in it. - // FIXME: avoid this by removing `warn_ambiguity`, or by triggering glob re-fetch - // with the same decl in some way. // - A glob decl is overwritten by a glob decl re-fetching an // overwritten decl from other module (the recursive case). // Here we are detecting all such re-fetches and overwrite old decls @@ -381,37 +405,28 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if deep_decl != glob_decl { // Some import layers have been removed, need to overwrite. assert_ne!(old_deep_decl, old_glob_decl); - // FIXME: reenable the asserts when `warn_ambiguity` is removed (#149195). - // assert_ne!(old_deep_decl, deep_decl); - // assert!(old_deep_decl.is_glob_import()); + assert_ne!(old_deep_decl, deep_decl); + assert!(old_deep_decl.is_glob_import()); assert!(!deep_decl.is_glob_import()); - if old_glob_decl.ambiguity.get().is_some() && glob_decl.ambiguity.get().is_none() { + if let Some((old_ambig, _)) = old_glob_decl.ambiguity.get() + && glob_decl.ambiguity.get().is_none() + { // Do not lose glob ambiguities when re-fetching the glob. - glob_decl.ambiguity.set_unchecked(old_glob_decl.ambiguity.get()); - } - if glob_decl.is_ambiguity_recursive() { - glob_decl.warn_ambiguity.set_unchecked(true); + glob_decl.ambiguity.set_unchecked(Some((old_ambig, true))); } glob_decl } else if glob_decl.res() != old_glob_decl.res() { - old_glob_decl.ambiguity.set_unchecked(Some(glob_decl)); - old_glob_decl.warn_ambiguity.set_unchecked(warn_ambiguity); - if warn_ambiguity { - old_glob_decl - } else { - // Need a fresh decl so other glob imports importing it could re-fetch it - // and set their own `warn_ambiguity` to true. - // FIXME: remove this when `warn_ambiguity` is removed (#149195). - self.arenas.alloc_decl((*old_glob_decl).clone()) - } + let warning = self.is_noise_0_7_0(old_glob_decl, glob_decl) + || self.is_rustybuzz_0_4_0(old_glob_decl, glob_decl); + old_glob_decl.ambiguity.set_unchecked(Some((glob_decl, warning))); + old_glob_decl } else if !old_glob_decl.vis().is_at_least(glob_decl.vis(), self.tcx) { // We are glob-importing the same item but with greater visibility. old_glob_decl.vis.set_unchecked(glob_decl.vis()); old_glob_decl } else if glob_decl.is_ambiguity_recursive() && !old_glob_decl.is_ambiguity_recursive() { // Overwriting a non-ambiguous glob import with an ambiguous glob import. - old_glob_decl.ambiguity.set_unchecked(Some(glob_decl)); - old_glob_decl.warn_ambiguity.set_unchecked(true); + old_glob_decl.ambiguity.set_unchecked(Some((glob_decl, true))); old_glob_decl } else { old_glob_decl @@ -426,7 +441,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { orig_ident_span: Span, ns: Namespace, decl: Decl<'ra>, - warn_ambiguity: bool, ) -> Result<(), Decl<'ra>> { let module = decl.parent_module.unwrap(); let res = decl.res(); @@ -438,52 +452,44 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { module.underscore_disambiguator.update_unchecked(|d| d + 1); module.underscore_disambiguator.get() }); - self.update_local_resolution( - module, - key, - orig_ident_span, - warn_ambiguity, - |this, resolution| { - if let Some(old_decl) = resolution.best_decl() { - assert_ne!(decl, old_decl); - assert!(!decl.warn_ambiguity.get()); - if res == Res::Err && old_decl.res() != Res::Err { - // Do not override real declarations with `Res::Err`s from error recovery. - return Ok(()); + self.update_local_resolution(module, key, orig_ident_span, |this, resolution| { + if let Some(old_decl) = resolution.best_decl() { + assert_ne!(decl, old_decl); + if res == Res::Err && old_decl.res() != Res::Err { + // Do not override real declarations with `Res::Err`s from error recovery. + return Ok(()); + } + match (old_decl.is_glob_import(), decl.is_glob_import()) { + (true, true) => { + resolution.glob_decl = Some(this.select_glob_decl(old_decl, decl)); } - match (old_decl.is_glob_import(), decl.is_glob_import()) { - (true, true) => { + (old_glob @ true, false) | (old_glob @ false, true) => { + let (glob_decl, non_glob_decl) = + if old_glob { (old_decl, decl) } else { (decl, old_decl) }; + resolution.non_glob_decl = Some(non_glob_decl); + if let Some(old_glob_decl) = resolution.glob_decl + && old_glob_decl != glob_decl + { resolution.glob_decl = - Some(this.select_glob_decl(old_decl, decl, warn_ambiguity)); - } - (old_glob @ true, false) | (old_glob @ false, true) => { - let (glob_decl, non_glob_decl) = - if old_glob { (old_decl, decl) } else { (decl, old_decl) }; - resolution.non_glob_decl = Some(non_glob_decl); - if let Some(old_glob_decl) = resolution.glob_decl - && old_glob_decl != glob_decl - { - resolution.glob_decl = - Some(this.select_glob_decl(old_glob_decl, glob_decl, false)); - } else { - resolution.glob_decl = Some(glob_decl); - } - } - (false, false) => { - return Err(old_decl); + Some(this.select_glob_decl(old_glob_decl, glob_decl)); + } else { + resolution.glob_decl = Some(glob_decl); } } - } else { - if decl.is_glob_import() { - resolution.glob_decl = Some(decl); - } else { - resolution.non_glob_decl = Some(decl); + (false, false) => { + return Err(old_decl); } } + } else { + if decl.is_glob_import() { + resolution.glob_decl = Some(decl); + } else { + resolution.non_glob_decl = Some(decl); + } + } - Ok(()) - }, - ) + Ok(()) + }) } // Use `f` to mutate the resolution of the name in the module. @@ -493,7 +499,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { module: Module<'ra>, key: BindingKey, orig_ident_span: Span, - warn_ambiguity: bool, f: F, ) -> T where @@ -501,7 +506,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { { // Ensure that `resolution` isn't borrowed when defining in the module's glob importers, // during which the resolution might end up getting re-defined via a glob cycle. - let (binding, t, warn_ambiguity) = { + let (binding, t) = { let resolution = &mut *self .resolution_or_default(module, key, orig_ident_span) .borrow_mut_unchecked(); @@ -512,7 +517,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if let Some(binding) = resolution.binding() && old_decl != Some(binding) { - (binding, t, warn_ambiguity || old_decl.is_some()) + (binding, t) } else { return t; } @@ -540,7 +545,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { orig_ident_span, key.ns, import_decl, - warn_ambiguity, ); } } @@ -560,25 +564,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { self.per_ns(|this, ns| { let module = import.parent_scope.module; let ident = IdentKey::new(target); - let _ = this.try_plant_decl_into_local_module( - ident, - target.span, - ns, - dummy_decl, - false, - ); + let _ = this.try_plant_decl_into_local_module(ident, target.span, ns, dummy_decl); // Don't remove underscores from `single_imports`, they were never added. if target.name != kw::Underscore { let key = BindingKey::new(ident, ns); - this.update_local_resolution( - module, - key, - target.span, - false, - |_, resolution| { - resolution.single_imports.swap_remove(&import); - }, - ) + this.update_local_resolution(module, key, target.span, |_, resolution| { + resolution.single_imports.swap_remove(&import); + }) } }); self.record_use(target, dummy_decl, Used::Other); @@ -709,7 +701,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let Some(binding) = resolution.best_decl() else { continue }; if let DeclKind::Import { import, .. } = binding.kind - && let Some(amb_binding) = binding.ambiguity.get() + && let Some((amb_binding, _)) = binding.ambiguity.get() && binding.res() != Res::Err && exported_ambiguities.contains(&binding) { @@ -968,7 +960,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { parent, key, target.span, - false, |_, resolution| { resolution.single_imports.swap_remove(&import); }, @@ -1579,16 +1570,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }; if self.is_accessible_from(binding.vis(), scope) { let import_decl = self.new_import_decl(binding, import); - let warn_ambiguity = self - .resolution(import.parent_scope.module, key) - .and_then(|r| r.binding()) - .is_some_and(|binding| binding.warn_ambiguity_recursive()); let _ = self.try_plant_decl_into_local_module( key.ident, orig_ident_span, key.ns, import_decl, - warn_ambiguity, ); } } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 5fe1be039a881..979d7216850ce 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -848,10 +848,7 @@ impl<'ra> fmt::Debug for Module<'ra> { #[derive(Clone, Debug)] struct DeclData<'ra> { kind: DeclKind<'ra>, - ambiguity: CmCell>>, - /// Produce a warning instead of an error when reporting ambiguities inside this binding. - /// May apply to indirect ambiguities under imports, so `ambiguity.is_some()` is not required. - warn_ambiguity: CmCell, + ambiguity: CmCell, bool /*warning*/)>>, expansion: LocalExpnId, span: Span, vis: CmCell>, @@ -992,7 +989,7 @@ impl<'ra> DeclData<'ra> { fn descent_to_ambiguity(self: Decl<'ra>) -> Option<(Decl<'ra>, Decl<'ra>)> { match self.ambiguity.get() { - Some(ambig_binding) => Some((self, ambig_binding)), + Some((ambig_binding, _)) => Some((self, ambig_binding)), None => match self.kind { DeclKind::Import { source_decl, .. } => source_decl.descent_to_ambiguity(), _ => None, @@ -1008,14 +1005,6 @@ impl<'ra> DeclData<'ra> { } } - fn warn_ambiguity_recursive(&self) -> bool { - self.warn_ambiguity.get() - || match self.kind { - DeclKind::Import { source_decl, .. } => source_decl.warn_ambiguity_recursive(), - _ => false, - } - } - fn is_possibly_imported_variant(&self) -> bool { match self.kind { DeclKind::Import { source_decl, .. } => source_decl.is_possibly_imported_variant(), @@ -1403,7 +1392,6 @@ impl<'ra> ResolverArenas<'ra> { self.alloc_decl(DeclData { kind: DeclKind::Def(res), ambiguity: CmCell::new(None), - warn_ambiguity: CmCell::new(false), vis: CmCell::new(vis), span, expansion, @@ -2067,17 +2055,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } fn record_use(&mut self, ident: Ident, used_decl: Decl<'ra>, used: Used) { - self.record_use_inner(ident, used_decl, used, used_decl.warn_ambiguity.get()); - } - - fn record_use_inner( - &mut self, - ident: Ident, - used_decl: Decl<'ra>, - used: Used, - warn_ambiguity: bool, - ) { - if let Some(b2) = used_decl.ambiguity.get() { + if let Some((b2, warning)) = used_decl.ambiguity.get() { let ambiguity_error = AmbiguityError { kind: AmbiguityKind::GlobVsGlob, ident, @@ -2085,7 +2063,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { b2, scope1: Scope::ModuleGlobs(used_decl.parent_module.unwrap(), None), scope2: Scope::ModuleGlobs(b2.parent_module.unwrap(), None), - warning: if warn_ambiguity { Some(AmbiguityWarning::GlobImport) } else { None }, + warning: if warning { Some(AmbiguityWarning::GlobImport) } else { None }, }; if !self.matches_previous_ambiguity_error(&ambiguity_error) { // avoid duplicated span information to be emit out @@ -2135,12 +2113,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { self.used_imports.insert(id); } self.add_to_glob_map(import, ident.name); - self.record_use_inner( - ident, - source_decl, - Used::Other, - warn_ambiguity || source_decl.warn_ambiguity.get(), - ); + self.record_use(ident, source_decl, Used::Other); } } diff --git a/tests/ui/imports/ambiguous-1.rs b/tests/ui/imports/ambiguous-1.rs index 31f39eee62b9a..6c8e7da74f967 100644 --- a/tests/ui/imports/ambiguous-1.rs +++ b/tests/ui/imports/ambiguous-1.rs @@ -1,8 +1,5 @@ -//@ check-pass // https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883 -#![warn(ambiguous_glob_imports)] - macro_rules! m { () => { pub fn id() {} @@ -27,6 +24,5 @@ pub use openssl::*; fn main() { id(); - //~^ WARNING `id` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR `id` is ambiguous } diff --git a/tests/ui/imports/ambiguous-1.stderr b/tests/ui/imports/ambiguous-1.stderr index 04ff3a36c7467..b891baafe5710 100644 --- a/tests/ui/imports/ambiguous-1.stderr +++ b/tests/ui/imports/ambiguous-1.stderr @@ -1,68 +1,34 @@ -warning: ambiguous glob re-exports - --> $DIR/ambiguous-1.rs:13:13 - | -LL | pub use self::evp::*; - | ^^^^^^^^^^^^ the name `id` in the value namespace is first re-exported here -LL | -LL | pub use self::handwritten::*; - | -------------------- but the name `id` in the value namespace is also re-exported here - | - = note: `#[warn(ambiguous_glob_reexports)]` on by default - -warning: `id` is ambiguous - --> $DIR/ambiguous-1.rs:29:5 +error[E0659]: `id` is ambiguous + --> $DIR/ambiguous-1.rs:26:5 | LL | id(); | ^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here - --> $DIR/ambiguous-1.rs:13:13 + --> $DIR/ambiguous-1.rs:10:13 | LL | pub use self::evp::*; | ^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate note: `id` could also refer to the function imported here - --> $DIR/ambiguous-1.rs:15:13 + --> $DIR/ambiguous-1.rs:12:13 | LL | pub use self::handwritten::*; | ^^^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate -note: the lint level is defined here - --> $DIR/ambiguous-1.rs:4:9 - | -LL | #![warn(ambiguous_glob_imports)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted -Future incompatibility report: Future breakage diagnostic: -warning: `id` is ambiguous - --> $DIR/ambiguous-1.rs:29:5 - | -LL | id(); - | ^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `id` could refer to the function imported here - --> $DIR/ambiguous-1.rs:13:13 +warning: ambiguous glob re-exports + --> $DIR/ambiguous-1.rs:10:13 | LL | pub use self::evp::*; - | ^^^^^^^^^^^^ - = help: consider adding an explicit import of `id` to disambiguate -note: `id` could also refer to the function imported here - --> $DIR/ambiguous-1.rs:15:13 - | + | ^^^^^^^^^^^^ the name `id` in the value namespace is first re-exported here +LL | LL | pub use self::handwritten::*; - | ^^^^^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `id` to disambiguate -note: the lint level is defined here - --> $DIR/ambiguous-1.rs:4:9 + | -------------------- but the name `id` in the value namespace is also re-exported here | -LL | #![warn(ambiguous_glob_imports)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(ambiguous_glob_reexports)]` on by default + +error: aborting due to 1 previous error; 1 warning emitted +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-10.rs b/tests/ui/imports/ambiguous-10.rs index 61069cb75124a..cbc8ce3a13c62 100644 --- a/tests/ui/imports/ambiguous-10.rs +++ b/tests/ui/imports/ambiguous-10.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296 -//@ check-pass + mod a { pub enum Token {} } @@ -13,6 +13,6 @@ mod b { use crate::a::*; use crate::b::*; fn c(_: Token) {} -//~^ WARN `Token` is ambiguous -//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +//~^ ERROR `Token` is ambiguous + fn main() { } diff --git a/tests/ui/imports/ambiguous-10.stderr b/tests/ui/imports/ambiguous-10.stderr index 4ae3e4203fab8..e3f126d338c49 100644 --- a/tests/ui/imports/ambiguous-10.stderr +++ b/tests/ui/imports/ambiguous-10.stderr @@ -1,11 +1,9 @@ -warning: `Token` is ambiguous +error[E0659]: `Token` is ambiguous --> $DIR/ambiguous-10.rs:15:9 | LL | fn c(_: Token) {} | ^^^^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Token` could refer to the enum imported here --> $DIR/ambiguous-10.rs:13:5 @@ -19,31 +17,7 @@ note: `Token` could also refer to the enum imported here LL | use crate::b::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `Token` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `Token` is ambiguous - --> $DIR/ambiguous-10.rs:15:9 - | -LL | fn c(_: Token) {} - | ^^^^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `Token` could refer to the enum imported here - --> $DIR/ambiguous-10.rs:13:5 - | -LL | use crate::a::*; - | ^^^^^^^^^^^ - = help: consider adding an explicit import of `Token` to disambiguate -note: `Token` could also refer to the enum imported here - --> $DIR/ambiguous-10.rs:14:5 - | -LL | use crate::b::*; - | ^^^^^^^^^^^ - = help: consider adding an explicit import of `Token` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-12.rs b/tests/ui/imports/ambiguous-12.rs index 93cd3ca6f347a..54bdf26e88cce 100644 --- a/tests/ui/imports/ambiguous-12.rs +++ b/tests/ui/imports/ambiguous-12.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296 -//@ check-pass + macro_rules! m { () => { pub fn b() {} @@ -19,6 +19,5 @@ use crate::public::*; fn main() { b(); - //~^ WARN `b` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR `b` is ambiguous } diff --git a/tests/ui/imports/ambiguous-12.stderr b/tests/ui/imports/ambiguous-12.stderr index 1a1777dedac48..099abd66e8a3c 100644 --- a/tests/ui/imports/ambiguous-12.stderr +++ b/tests/ui/imports/ambiguous-12.stderr @@ -1,11 +1,9 @@ -warning: `b` is ambiguous +error[E0659]: `b` is ambiguous --> $DIR/ambiguous-12.rs:21:5 | LL | b(); | ^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `b` could refer to the function imported here --> $DIR/ambiguous-12.rs:17:5 @@ -19,31 +17,7 @@ note: `b` could also refer to the function imported here LL | use crate::public::*; | ^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `b` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `b` is ambiguous - --> $DIR/ambiguous-12.rs:21:5 - | -LL | b(); - | ^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `b` could refer to the function imported here - --> $DIR/ambiguous-12.rs:17:5 - | -LL | use crate::ciphertext::*; - | ^^^^^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `b` to disambiguate -note: `b` could also refer to the function imported here - --> $DIR/ambiguous-12.rs:18:5 - | -LL | use crate::public::*; - | ^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `b` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-13.rs b/tests/ui/imports/ambiguous-13.rs index 5fbb71d8545a0..dc58bbbc63d57 100644 --- a/tests/ui/imports/ambiguous-13.rs +++ b/tests/ui/imports/ambiguous-13.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296 -//@ check-pass + pub mod object { #[derive(Debug)] pub struct Rect; @@ -16,6 +16,6 @@ use crate::object::*; use crate::content::*; fn a(_: Rect) {} -//~^ WARN `Rect` is ambiguous -//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +//~^ ERROR `Rect` is ambiguous + fn main() { } diff --git a/tests/ui/imports/ambiguous-13.stderr b/tests/ui/imports/ambiguous-13.stderr index ca83cf63c12c1..1d105eec0e36f 100644 --- a/tests/ui/imports/ambiguous-13.stderr +++ b/tests/ui/imports/ambiguous-13.stderr @@ -1,11 +1,9 @@ -warning: `Rect` is ambiguous +error[E0659]: `Rect` is ambiguous --> $DIR/ambiguous-13.rs:18:9 | LL | fn a(_: Rect) {} | ^^^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Rect` could refer to the struct imported here --> $DIR/ambiguous-13.rs:15:5 @@ -19,31 +17,7 @@ note: `Rect` could also refer to the struct imported here LL | use crate::content::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Rect` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `Rect` is ambiguous - --> $DIR/ambiguous-13.rs:18:9 - | -LL | fn a(_: Rect) {} - | ^^^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `Rect` could refer to the struct imported here - --> $DIR/ambiguous-13.rs:15:5 - | -LL | use crate::object::*; - | ^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `Rect` to disambiguate -note: `Rect` could also refer to the struct imported here - --> $DIR/ambiguous-13.rs:16:5 - | -LL | use crate::content::*; - | ^^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `Rect` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-15.rs b/tests/ui/imports/ambiguous-15.rs index f90d9696e8efd..72c2940573c6b 100644 --- a/tests/ui/imports/ambiguous-15.rs +++ b/tests/ui/imports/ambiguous-15.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152 -//@ check-pass + mod t2 { #[derive(Debug)] pub enum Error {} @@ -20,7 +20,6 @@ mod t3 { use self::t3::*; fn a(_: E) {} -//~^ WARN `Error` is ambiguous -//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +//~^ ERROR `Error` is ambiguous fn main() {} diff --git a/tests/ui/imports/ambiguous-15.stderr b/tests/ui/imports/ambiguous-15.stderr index 59f9cb0526fcc..fb3551d76274c 100644 --- a/tests/ui/imports/ambiguous-15.stderr +++ b/tests/ui/imports/ambiguous-15.stderr @@ -1,11 +1,9 @@ -warning: `Error` is ambiguous +error[E0659]: `Error` is ambiguous --> $DIR/ambiguous-15.rs:22:9 | LL | fn a(_: E) {} | ^^^^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Error` could refer to the trait imported here --> $DIR/ambiguous-15.rs:21:5 @@ -19,31 +17,7 @@ note: `Error` could also refer to the enum imported here LL | pub use t2::*; | ^^^^^ = help: consider adding an explicit import of `Error` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `Error` is ambiguous - --> $DIR/ambiguous-15.rs:22:9 - | -LL | fn a(_: E) {} - | ^^^^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `Error` could refer to the trait imported here - --> $DIR/ambiguous-15.rs:21:5 - | -LL | use self::t3::*; - | ^^^^^^^^^^^ - = help: consider adding an explicit import of `Error` to disambiguate -note: `Error` could also refer to the enum imported here - --> $DIR/ambiguous-15.rs:15:9 - | -LL | pub use t2::*; - | ^^^^^ - = help: consider adding an explicit import of `Error` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-16.rs b/tests/ui/imports/ambiguous-16.rs index 2cd1e2aca9d33..a20c0e340d601 100644 --- a/tests/ui/imports/ambiguous-16.rs +++ b/tests/ui/imports/ambiguous-16.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/pull/113099 -//@ check-pass + mod framing { mod public_message { use super::*; @@ -20,7 +20,6 @@ mod framing { } use crate::framing::ConfirmedTranscriptHashInput; -//~^ WARN `ConfirmedTranscriptHashInput` is ambiguous -//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +//~^ ERROR `ConfirmedTranscriptHashInput` is ambiguous fn main() { } diff --git a/tests/ui/imports/ambiguous-16.stderr b/tests/ui/imports/ambiguous-16.stderr index bb76111ebe89e..c18242d4a3cfc 100644 --- a/tests/ui/imports/ambiguous-16.stderr +++ b/tests/ui/imports/ambiguous-16.stderr @@ -1,11 +1,9 @@ -warning: `ConfirmedTranscriptHashInput` is ambiguous +error[E0659]: `ConfirmedTranscriptHashInput` is ambiguous --> $DIR/ambiguous-16.rs:22:21 | LL | use crate::framing::ConfirmedTranscriptHashInput; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `ConfirmedTranscriptHashInput` could refer to the struct imported here --> $DIR/ambiguous-16.rs:18:13 @@ -19,31 +17,7 @@ note: `ConfirmedTranscriptHashInput` could also refer to the struct imported her LL | pub use self::public_message_in::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `ConfirmedTranscriptHashInput` is ambiguous - --> $DIR/ambiguous-16.rs:22:21 - | -LL | use crate::framing::ConfirmedTranscriptHashInput; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `ConfirmedTranscriptHashInput` could refer to the struct imported here - --> $DIR/ambiguous-16.rs:18:13 - | -LL | pub use self::public_message::*; - | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate -note: `ConfirmedTranscriptHashInput` could also refer to the struct imported here - --> $DIR/ambiguous-16.rs:19:13 - | -LL | pub use self::public_message_in::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-17.rs b/tests/ui/imports/ambiguous-17.rs index 8ef0318fa046b..5ba51ce714b75 100644 --- a/tests/ui/imports/ambiguous-17.rs +++ b/tests/ui/imports/ambiguous-17.rs @@ -1,6 +1,6 @@ //@ edition:2015 // https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152 -//@ check-pass + pub use evp::*; //~ WARNING ambiguous glob re-exports pub use handwritten::*; @@ -24,6 +24,5 @@ mod handwritten { fn main() { id(); - //~^ WARN `id` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR `id` is ambiguous } diff --git a/tests/ui/imports/ambiguous-17.stderr b/tests/ui/imports/ambiguous-17.stderr index ef4a835a0b3c5..b46a9430d2a7c 100644 --- a/tests/ui/imports/ambiguous-17.stderr +++ b/tests/ui/imports/ambiguous-17.stderr @@ -1,21 +1,9 @@ -warning: ambiguous glob re-exports - --> $DIR/ambiguous-17.rs:4:9 - | -LL | pub use evp::*; - | ^^^^^^ the name `id` in the value namespace is first re-exported here -LL | pub use handwritten::*; - | -------------- but the name `id` in the value namespace is also re-exported here - | - = note: `#[warn(ambiguous_glob_reexports)]` on by default - -warning: `id` is ambiguous +error[E0659]: `id` is ambiguous --> $DIR/ambiguous-17.rs:26:5 | LL | id(); | ^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here --> $DIR/ambiguous-17.rs:4:9 @@ -29,31 +17,17 @@ note: `id` could also refer to the function imported here LL | pub use handwritten::*; | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -warning: 2 warnings emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `id` is ambiguous - --> $DIR/ambiguous-17.rs:26:5 - | -LL | id(); - | ^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `id` could refer to the function imported here +warning: ambiguous glob re-exports --> $DIR/ambiguous-17.rs:4:9 | LL | pub use evp::*; - | ^^^^^^ - = help: consider adding an explicit import of `id` to disambiguate -note: `id` could also refer to the function imported here - --> $DIR/ambiguous-17.rs:5:9 - | + | ^^^^^^ the name `id` in the value namespace is first re-exported here LL | pub use handwritten::*; - | ^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `id` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default + | -------------- but the name `id` in the value namespace is also re-exported here + | + = note: `#[warn(ambiguous_glob_reexports)]` on by default + +error: aborting due to 1 previous error; 1 warning emitted +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-2.rs b/tests/ui/imports/ambiguous-2.rs deleted file mode 100644 index 978655bc01776..0000000000000 --- a/tests/ui/imports/ambiguous-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ aux-build: ../ambiguous-1.rs -// https://github.com/rust-lang/rust/pull/113099#issuecomment-1633574396 -//@ check-pass -extern crate ambiguous_1; - -fn main() { - ambiguous_1::id(); //~ WARN `id` is ambiguous - //~| WARN this was previously accepted -} diff --git a/tests/ui/imports/ambiguous-2.stderr b/tests/ui/imports/ambiguous-2.stderr deleted file mode 100644 index 5b12491af19d1..0000000000000 --- a/tests/ui/imports/ambiguous-2.stderr +++ /dev/null @@ -1,49 +0,0 @@ -warning: `id` is ambiguous - --> $DIR/ambiguous-2.rs:7:18 - | -LL | ambiguous_1::id(); - | ^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `id` could refer to the function defined here - --> $DIR/auxiliary/../ambiguous-1.rs:13:13 - | -LL | pub use self::evp::*; - | ^^^^^^^^^ - = help: consider updating this dependency to resolve this error - = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate -note: `id` could also refer to the function defined here - --> $DIR/auxiliary/../ambiguous-1.rs:15:13 - | -LL | pub use self::handwritten::*; - | ^^^^^^^^^^^^^^^^^ - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `id` is ambiguous - --> $DIR/ambiguous-2.rs:7:18 - | -LL | ambiguous_1::id(); - | ^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `id` could refer to the function defined here - --> $DIR/auxiliary/../ambiguous-1.rs:13:13 - | -LL | pub use self::evp::*; - | ^^^^^^^^^ - = help: consider updating this dependency to resolve this error - = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate -note: `id` could also refer to the function defined here - --> $DIR/auxiliary/../ambiguous-1.rs:15:13 - | -LL | pub use self::handwritten::*; - | ^^^^^^^^^^^^^^^^^ - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - diff --git a/tests/ui/imports/ambiguous-3.rs b/tests/ui/imports/ambiguous-3.rs index 717c1eb8597ac..4919d9fbac63d 100644 --- a/tests/ui/imports/ambiguous-3.rs +++ b/tests/ui/imports/ambiguous-3.rs @@ -1,10 +1,9 @@ // https://github.com/rust-lang/rust/issues/47525 -//@ check-pass + fn main() { use a::*; x(); - //~^ WARN `x` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR `x` is ambiguous } mod a { diff --git a/tests/ui/imports/ambiguous-3.stderr b/tests/ui/imports/ambiguous-3.stderr index 7addf9bc797c5..6c3031a9807aa 100644 --- a/tests/ui/imports/ambiguous-3.stderr +++ b/tests/ui/imports/ambiguous-3.stderr @@ -1,49 +1,23 @@ -warning: `x` is ambiguous +error[E0659]: `x` is ambiguous --> $DIR/ambiguous-3.rs:5:5 | LL | x(); | ^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `x` could refer to the function imported here - --> $DIR/ambiguous-3.rs:18:13 + --> $DIR/ambiguous-3.rs:17:13 | LL | pub use self::b::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `x` to disambiguate note: `x` could also refer to the function imported here - --> $DIR/ambiguous-3.rs:19:13 - | -LL | pub use self::c::*; - | ^^^^^^^^^^ - = help: consider adding an explicit import of `x` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `x` is ambiguous - --> $DIR/ambiguous-3.rs:5:5 - | -LL | x(); - | ^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `x` could refer to the function imported here --> $DIR/ambiguous-3.rs:18:13 | -LL | pub use self::b::*; - | ^^^^^^^^^^ - = help: consider adding an explicit import of `x` to disambiguate -note: `x` could also refer to the function imported here - --> $DIR/ambiguous-3.rs:19:13 - | LL | pub use self::c::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `x` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-4-extern.rs b/tests/ui/imports/ambiguous-4-extern.rs index 125612dea03e5..a062b38df617e 100644 --- a/tests/ui/imports/ambiguous-4-extern.rs +++ b/tests/ui/imports/ambiguous-4-extern.rs @@ -1,9 +1,6 @@ //@ edition:2015 -//@ check-pass // https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883 -#![warn(ambiguous_glob_imports)] - macro_rules! m { () => { pub fn id() {} @@ -24,6 +21,5 @@ mod handwritten { fn main() { id(); - //~^ WARNING `id` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR `id` is ambiguous } diff --git a/tests/ui/imports/ambiguous-4-extern.stderr b/tests/ui/imports/ambiguous-4-extern.stderr index 87492dee67fb4..dae8432118f45 100644 --- a/tests/ui/imports/ambiguous-4-extern.stderr +++ b/tests/ui/imports/ambiguous-4-extern.stderr @@ -1,67 +1,33 @@ -warning: ambiguous glob re-exports - --> $DIR/ambiguous-4-extern.rs:13:9 - | -LL | pub use evp::*; - | ^^^^^^ the name `id` in the value namespace is first re-exported here -LL | pub use handwritten::*; - | -------------- but the name `id` in the value namespace is also re-exported here - | - = note: `#[warn(ambiguous_glob_reexports)]` on by default - -warning: `id` is ambiguous - --> $DIR/ambiguous-4-extern.rs:26:5 +error[E0659]: `id` is ambiguous + --> $DIR/ambiguous-4-extern.rs:23:5 | LL | id(); | ^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here - --> $DIR/ambiguous-4-extern.rs:13:9 + --> $DIR/ambiguous-4-extern.rs:10:9 | LL | pub use evp::*; | ^^^^^^ = help: consider adding an explicit import of `id` to disambiguate note: `id` could also refer to the function imported here - --> $DIR/ambiguous-4-extern.rs:14:9 + --> $DIR/ambiguous-4-extern.rs:11:9 | LL | pub use handwritten::*; | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate -note: the lint level is defined here - --> $DIR/ambiguous-4-extern.rs:5:9 - | -LL | #![warn(ambiguous_glob_imports)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted -Future incompatibility report: Future breakage diagnostic: -warning: `id` is ambiguous - --> $DIR/ambiguous-4-extern.rs:26:5 - | -LL | id(); - | ^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `id` could refer to the function imported here - --> $DIR/ambiguous-4-extern.rs:13:9 +warning: ambiguous glob re-exports + --> $DIR/ambiguous-4-extern.rs:10:9 | LL | pub use evp::*; - | ^^^^^^ - = help: consider adding an explicit import of `id` to disambiguate -note: `id` could also refer to the function imported here - --> $DIR/ambiguous-4-extern.rs:14:9 - | + | ^^^^^^ the name `id` in the value namespace is first re-exported here LL | pub use handwritten::*; - | ^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `id` to disambiguate -note: the lint level is defined here - --> $DIR/ambiguous-4-extern.rs:5:9 + | -------------- but the name `id` in the value namespace is also re-exported here | -LL | #![warn(ambiguous_glob_imports)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(ambiguous_glob_reexports)]` on by default + +error: aborting due to 1 previous error; 1 warning emitted +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-4.rs b/tests/ui/imports/ambiguous-4.rs deleted file mode 100644 index 1a2bfeaf53dc6..0000000000000 --- a/tests/ui/imports/ambiguous-4.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ edition:2015 -//@ aux-build: ../ambiguous-4-extern.rs -//@ check-pass -extern crate ambiguous_4_extern; - -fn main() { - ambiguous_4_extern::id(); //~ WARN `id` is ambiguous - //~| WARN this was previously accepted -} diff --git a/tests/ui/imports/ambiguous-4.stderr b/tests/ui/imports/ambiguous-4.stderr deleted file mode 100644 index 691dd33a398ab..0000000000000 --- a/tests/ui/imports/ambiguous-4.stderr +++ /dev/null @@ -1,49 +0,0 @@ -warning: `id` is ambiguous - --> $DIR/ambiguous-4.rs:7:25 - | -LL | ambiguous_4_extern::id(); - | ^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `id` could refer to the function defined here - --> $DIR/auxiliary/../ambiguous-4-extern.rs:13:9 - | -LL | pub use evp::*; - | ^^^ - = help: consider updating this dependency to resolve this error - = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate -note: `id` could also refer to the function defined here - --> $DIR/auxiliary/../ambiguous-4-extern.rs:14:9 - | -LL | pub use handwritten::*; - | ^^^^^^^^^^^ - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `id` is ambiguous - --> $DIR/ambiguous-4.rs:7:25 - | -LL | ambiguous_4_extern::id(); - | ^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `id` could refer to the function defined here - --> $DIR/auxiliary/../ambiguous-4-extern.rs:13:9 - | -LL | pub use evp::*; - | ^^^ - = help: consider updating this dependency to resolve this error - = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate -note: `id` could also refer to the function defined here - --> $DIR/auxiliary/../ambiguous-4-extern.rs:14:9 - | -LL | pub use handwritten::*; - | ^^^^^^^^^^^ - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - diff --git a/tests/ui/imports/ambiguous-5.rs b/tests/ui/imports/ambiguous-5.rs index 9879216280a29..a88dbf46ddab9 100644 --- a/tests/ui/imports/ambiguous-5.rs +++ b/tests/ui/imports/ambiguous-5.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296 -//@ check-pass + mod a { pub struct Class(u16); } @@ -10,8 +10,7 @@ mod gpos { use super::gsubgpos::*; use super::*; struct MarkRecord(Class); - //~^ WARN`Class` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR`Class` is ambiguous } mod gsubgpos { diff --git a/tests/ui/imports/ambiguous-5.stderr b/tests/ui/imports/ambiguous-5.stderr index a4f3151c9e85c..e2dfe4d2dea85 100644 --- a/tests/ui/imports/ambiguous-5.stderr +++ b/tests/ui/imports/ambiguous-5.stderr @@ -1,11 +1,9 @@ -warning: `Class` is ambiguous +error[E0659]: `Class` is ambiguous --> $DIR/ambiguous-5.rs:12:23 | LL | struct MarkRecord(Class); | ^^^^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Class` could refer to the struct imported here --> $DIR/ambiguous-5.rs:11:9 @@ -19,31 +17,7 @@ note: `Class` could also refer to the struct imported here LL | use super::gsubgpos::*; | ^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Class` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `Class` is ambiguous - --> $DIR/ambiguous-5.rs:12:23 - | -LL | struct MarkRecord(Class); - | ^^^^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `Class` could refer to the struct imported here - --> $DIR/ambiguous-5.rs:11:9 - | -LL | use super::*; - | ^^^^^^^^ - = help: consider adding an explicit import of `Class` to disambiguate -note: `Class` could also refer to the struct imported here - --> $DIR/ambiguous-5.rs:10:9 - | -LL | use super::gsubgpos::*; - | ^^^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `Class` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-6.rs b/tests/ui/imports/ambiguous-6.rs index 9a3a138bda4c7..71667a8f3bb80 100644 --- a/tests/ui/imports/ambiguous-6.rs +++ b/tests/ui/imports/ambiguous-6.rs @@ -1,11 +1,10 @@ //@ edition: 2021 // https://github.com/rust-lang/rust/issues/112713 -//@ check-pass + pub fn foo() -> u32 { use sub::*; C - //~^ WARN `C` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR `C` is ambiguous } mod sub { diff --git a/tests/ui/imports/ambiguous-6.stderr b/tests/ui/imports/ambiguous-6.stderr index d811cfa4236aa..f1a4fb694c9a0 100644 --- a/tests/ui/imports/ambiguous-6.stderr +++ b/tests/ui/imports/ambiguous-6.stderr @@ -1,49 +1,23 @@ -warning: `C` is ambiguous +error[E0659]: `C` is ambiguous --> $DIR/ambiguous-6.rs:6:5 | LL | C | ^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the constant imported here - --> $DIR/ambiguous-6.rs:15:13 + --> $DIR/ambiguous-6.rs:14:13 | LL | pub use mod1::*; | ^^^^^^^ = help: consider adding an explicit import of `C` to disambiguate note: `C` could also refer to the constant imported here - --> $DIR/ambiguous-6.rs:16:13 - | -LL | pub use mod2::*; - | ^^^^^^^ - = help: consider adding an explicit import of `C` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `C` is ambiguous - --> $DIR/ambiguous-6.rs:6:5 - | -LL | C - | ^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `C` could refer to the constant imported here --> $DIR/ambiguous-6.rs:15:13 | -LL | pub use mod1::*; - | ^^^^^^^ - = help: consider adding an explicit import of `C` to disambiguate -note: `C` could also refer to the constant imported here - --> $DIR/ambiguous-6.rs:16:13 - | LL | pub use mod2::*; | ^^^^^^^ = help: consider adding an explicit import of `C` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-9.rs b/tests/ui/imports/ambiguous-9.rs index e6329b8d46acc..58796031bf18f 100644 --- a/tests/ui/imports/ambiguous-9.rs +++ b/tests/ui/imports/ambiguous-9.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152 -//@ check-pass + pub mod dsl { mod range { pub fn date_range() {} @@ -21,8 +21,6 @@ use prelude::*; fn main() { date_range(); - //~^ WARN `date_range` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - //~| WARN `date_range` is ambiguous - //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR `date_range` is ambiguous + //~| ERROR `date_range` is ambiguous } diff --git a/tests/ui/imports/ambiguous-9.stderr b/tests/ui/imports/ambiguous-9.stderr index da7d2d970fdda..b6e4c30a8d410 100644 --- a/tests/ui/imports/ambiguous-9.stderr +++ b/tests/ui/imports/ambiguous-9.stderr @@ -1,52 +1,9 @@ -warning: ambiguous glob re-exports - --> $DIR/ambiguous-9.rs:7:13 - | -LL | pub use self::range::*; - | ^^^^^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here -LL | use super::prelude::*; - | ----------------- but the name `date_range` in the value namespace is also re-exported here - | - = note: `#[warn(ambiguous_glob_reexports)]` on by default - -warning: `date_range` is ambiguous - --> $DIR/ambiguous-9.rs:23:5 - | -LL | date_range(); - | ^^^^^^^^^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `date_range` could refer to the function imported here - --> $DIR/ambiguous-9.rs:7:13 - | -LL | pub use self::range::*; - | ^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `date_range` to disambiguate -note: `date_range` could also refer to the function imported here - --> $DIR/ambiguous-9.rs:8:9 - | -LL | use super::prelude::*; - | ^^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `date_range` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - -warning: ambiguous glob re-exports - --> $DIR/ambiguous-9.rs:15:13 - | -LL | pub use self::t::*; - | ^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here -LL | pub use super::dsl::*; - | ------------- but the name `date_range` in the value namespace is also re-exported here - -warning: `date_range` is ambiguous +error[E0659]: `date_range` is ambiguous --> $DIR/ambiguous-9.rs:23:5 | LL | date_range(); | ^^^^^^^^^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `date_range` could refer to the function imported here --> $DIR/ambiguous-9.rs:19:5 @@ -61,17 +18,12 @@ LL | use prelude::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate -warning: 4 warnings emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `date_range` is ambiguous +error[E0659]: `date_range` is ambiguous --> $DIR/ambiguous-9.rs:23:5 | LL | date_range(); | ^^^^^^^^^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `date_range` could refer to the function imported here --> $DIR/ambiguous-9.rs:7:13 @@ -85,29 +37,25 @@ note: `date_range` could also refer to the function imported here LL | use super::prelude::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -Future breakage diagnostic: -warning: `date_range` is ambiguous - --> $DIR/ambiguous-9.rs:23:5 - | -LL | date_range(); - | ^^^^^^^^^^ ambiguous name +warning: ambiguous glob re-exports + --> $DIR/ambiguous-9.rs:7:13 | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `date_range` could refer to the function imported here - --> $DIR/ambiguous-9.rs:19:5 +LL | pub use self::range::*; + | ^^^^^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here +LL | use super::prelude::*; + | ----------------- but the name `date_range` in the value namespace is also re-exported here | -LL | use dsl::*; - | ^^^^^^ - = help: consider adding an explicit import of `date_range` to disambiguate -note: `date_range` could also refer to the function imported here - --> $DIR/ambiguous-9.rs:20:5 + = note: `#[warn(ambiguous_glob_reexports)]` on by default + +warning: ambiguous glob re-exports + --> $DIR/ambiguous-9.rs:15:13 | -LL | use prelude::*; - | ^^^^^^^^^^ - = help: consider adding an explicit import of `date_range` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +LL | pub use self::t::*; + | ^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here +LL | pub use super::dsl::*; + | ------------- but the name `date_range` in the value namespace is also re-exported here + +error: aborting due to 2 previous errors; 2 warnings emitted +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/ambiguous-panic-globvsglob.rs b/tests/ui/imports/ambiguous-panic-globvsglob.rs index 335fba74b2088..4b35d6014b06b 100644 --- a/tests/ui/imports/ambiguous-panic-globvsglob.rs +++ b/tests/ui/imports/ambiguous-panic-globvsglob.rs @@ -3,7 +3,7 @@ mod m1 { pub use core::prelude::v1::*; } -//@ check-pass + mod m2 { pub use std::prelude::v1::*; } @@ -18,6 +18,5 @@ fn foo() { panic!(); //~^ WARN: `panic` is ambiguous [ambiguous_panic_imports] //~| WARN: this was previously accepted by the compiler - //~| WARN: `panic` is ambiguous [ambiguous_glob_imports] - //~| WARN: this was previously accepted by the compiler + //~| ERROR: `panic` is ambiguous } diff --git a/tests/ui/imports/ambiguous-panic-globvsglob.stderr b/tests/ui/imports/ambiguous-panic-globvsglob.stderr index 8e216b21734f5..94d941ef0d1ee 100644 --- a/tests/ui/imports/ambiguous-panic-globvsglob.stderr +++ b/tests/ui/imports/ambiguous-panic-globvsglob.stderr @@ -1,11 +1,9 @@ -warning: `panic` is ambiguous +error[E0659]: `panic` is ambiguous --> $DIR/ambiguous-panic-globvsglob.rs:18:5 | LL | panic!(); | ^^^^^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-globvsglob.rs:12:9 @@ -19,7 +17,6 @@ note: `panic` could also refer to the macro imported here LL | use m2::*; | ^^^^^ = help: consider adding an explicit import of `panic` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default warning: `panic` is ambiguous --> $DIR/ambiguous-panic-globvsglob.rs:18:5 @@ -40,29 +37,6 @@ note: `panic` could also refer to a macro from prelude --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL = note: `#[warn(ambiguous_panic_imports)]` (part of `#[warn(future_incompatible)]`) on by default -warning: 2 warnings emitted - -Future incompatibility report: Future breakage diagnostic: -warning: `panic` is ambiguous - --> $DIR/ambiguous-panic-globvsglob.rs:18:5 - | -LL | panic!(); - | ^^^^^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `panic` could refer to the macro imported here - --> $DIR/ambiguous-panic-globvsglob.rs:12:9 - | -LL | use m1::*; - | ^^^^^ - = help: consider adding an explicit import of `panic` to disambiguate -note: `panic` could also refer to the macro imported here - --> $DIR/ambiguous-panic-globvsglob.rs:13:9 - | -LL | use m2::*; - | ^^^^^ - = help: consider adding an explicit import of `panic` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error; 1 warning emitted +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/imports/glob-conflict-cross-crate-3.rs b/tests/ui/imports/glob-conflict-cross-crate-3.rs index a7b215359090d..ba0441fed24bd 100644 --- a/tests/ui/imports/glob-conflict-cross-crate-3.rs +++ b/tests/ui/imports/glob-conflict-cross-crate-3.rs @@ -1,5 +1,5 @@ //@ aux-build:glob-conflict-cross-crate-2-extern.rs -//@ check-pass + extern crate glob_conflict_cross_crate_2_extern; mod a { @@ -11,8 +11,7 @@ use a::*; fn main() { let _a: C = 1; - //~^ WARN `C` is ambiguous + //~^ ERROR `C` is ambiguous //~| WARN `C` is ambiguous //~| WARN this was previously accepted - //~| WARN this was previously accepted } diff --git a/tests/ui/imports/glob-conflict-cross-crate-3.stderr b/tests/ui/imports/glob-conflict-cross-crate-3.stderr index 9b6867774ebea..d3b2822492436 100644 --- a/tests/ui/imports/glob-conflict-cross-crate-3.stderr +++ b/tests/ui/imports/glob-conflict-cross-crate-3.stderr @@ -1,34 +1,9 @@ -warning: `C` is ambiguous +error[E0659]: `C` is ambiguous --> $DIR/glob-conflict-cross-crate-3.rs:13:13 | LL | let _a: C = 1; | ^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `C` could refer to the type alias defined here - --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:9:9 - | -LL | pub use a::*; - | ^ - = help: consider updating this dependency to resolve this error - = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate -note: `C` could also refer to the type alias defined here - --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:10:9 - | -LL | pub use b::*; - | ^ - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - -warning: `C` is ambiguous - --> $DIR/glob-conflict-cross-crate-3.rs:13:13 - | -LL | let _a: C = 1; - | ^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the type alias imported here --> $DIR/glob-conflict-cross-crate-3.rs:9:5 @@ -43,9 +18,6 @@ LL | use a::*; | ^^^^ = help: consider adding an explicit import of `C` to disambiguate -warning: 2 warnings emitted - -Future incompatibility report: Future breakage diagnostic: warning: `C` is ambiguous --> $DIR/glob-conflict-cross-crate-3.rs:13:13 | @@ -69,7 +41,10 @@ LL | pub use b::*; | ^ = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default -Future breakage diagnostic: +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0659`. +Future incompatibility report: Future breakage diagnostic: warning: `C` is ambiguous --> $DIR/glob-conflict-cross-crate-3.rs:13:13 | @@ -79,17 +54,17 @@ LL | let _a: C = 1; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module -note: `C` could refer to the type alias imported here - --> $DIR/glob-conflict-cross-crate-3.rs:9:5 +note: `C` could refer to the type alias defined here + --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:9:9 | -LL | use glob_conflict_cross_crate_2_extern::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: consider adding an explicit import of `C` to disambiguate -note: `C` could also refer to the type alias imported here - --> $DIR/glob-conflict-cross-crate-3.rs:10:5 +LL | pub use a::*; + | ^ + = help: consider updating this dependency to resolve this error + = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate +note: `C` could also refer to the type alias defined here + --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:10:9 | -LL | use a::*; - | ^^^^ - = help: consider adding an explicit import of `C` to disambiguate +LL | pub use b::*; + | ^ = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default diff --git a/tests/ui/imports/unresolved-seg-after-ambiguous.rs b/tests/ui/imports/unresolved-seg-after-ambiguous.rs index 820f579ae3bbf..00a3c5b0145c2 100644 --- a/tests/ui/imports/unresolved-seg-after-ambiguous.rs +++ b/tests/ui/imports/unresolved-seg-after-ambiguous.rs @@ -17,8 +17,6 @@ mod a { } use self::a::E::in_exist; -//~^ ERROR: unresolved import `self::a::E` -//~| WARN: `E` is ambiguous -//~| WARNING: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +//~^ ERROR: `E` is ambiguous fn main() {} diff --git a/tests/ui/imports/unresolved-seg-after-ambiguous.stderr b/tests/ui/imports/unresolved-seg-after-ambiguous.stderr index 411cd1dbe5efa..e712d80f69460 100644 --- a/tests/ui/imports/unresolved-seg-after-ambiguous.stderr +++ b/tests/ui/imports/unresolved-seg-after-ambiguous.stderr @@ -1,17 +1,9 @@ -error[E0432]: unresolved import `self::a::E` - --> $DIR/unresolved-seg-after-ambiguous.rs:19:14 - | -LL | use self::a::E::in_exist; - | ^ `E` is a struct, not a module - -warning: `E` is ambiguous +error[E0659]: `E` is ambiguous --> $DIR/unresolved-seg-after-ambiguous.rs:19:14 | LL | use self::a::E::in_exist; | ^ ambiguous name | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `E` could refer to the struct imported here --> $DIR/unresolved-seg-after-ambiguous.rs:13:17 @@ -25,32 +17,7 @@ note: `E` could also refer to the struct imported here LL | pub use self::d::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `E` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default - -error: aborting due to 1 previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0432`. -Future incompatibility report: Future breakage diagnostic: -warning: `E` is ambiguous - --> $DIR/unresolved-seg-after-ambiguous.rs:19:14 - | -LL | use self::a::E::in_exist; - | ^ ambiguous name - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #114095 - = note: ambiguous because of multiple glob imports of a name in the same module -note: `E` could refer to the struct imported here - --> $DIR/unresolved-seg-after-ambiguous.rs:13:17 - | -LL | pub use self::c::*; - | ^^^^^^^^^^ - = help: consider adding an explicit import of `E` to disambiguate -note: `E` could also refer to the struct imported here - --> $DIR/unresolved-seg-after-ambiguous.rs:12:17 - | -LL | pub use self::d::*; - | ^^^^^^^^^^ - = help: consider adding an explicit import of `E` to disambiguate - = note: `#[warn(ambiguous_glob_imports)]` (part of `#[warn(future_incompatible)]`) on by default +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0659`.