From b541f1b1983da61eeef8c90edc230edb4eb2581c Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 16 Feb 2026 15:32:00 +0300 Subject: [PATCH] resolve: Disable an assert that no longer holds --- compiler/rustc_resolve/src/imports.rs | 5 ++++- tests/ui/imports/overwrite-different-vis-3.rs | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/ui/imports/overwrite-different-vis-3.rs diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 4e7622d08462e..0991ba5a2de11 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -371,6 +371,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // - 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 with larger visibility. + // FIXME: avoid this by updating this visibility in place. // - 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 @@ -384,7 +386,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // 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!(!deep_decl.is_glob_import()); + // FIXME: reenable the assert when visibility is updated in place. + // assert!(!deep_decl.is_glob_import()); if old_glob_decl.ambiguity.get().is_some() && 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()); diff --git a/tests/ui/imports/overwrite-different-vis-3.rs b/tests/ui/imports/overwrite-different-vis-3.rs new file mode 100644 index 0000000000000..f45c5cdfb3abf --- /dev/null +++ b/tests/ui/imports/overwrite-different-vis-3.rs @@ -0,0 +1,14 @@ +// Regression test for issue #152606. + +//@ check-pass + +mod outer { + mod inner { + use super::*; // should go before the ambiguous glob imports + } + + use crate::*; + pub use crate::*; +} + +fn main() {}