diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 1b9e5d2a2daa6..b36dd1ef31bb9 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -822,6 +822,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { for decl in [resolution.non_glob_decl, resolution.glob_decl] { if let Some(decl) = decl && let DeclKind::Import { source_decl, import } = decl.kind + // FIXME: Do not check visibility-ambiguous imports for now. To check them + // properly we need to preserve all imports in ambiguous glob sets and + // check them all individually. + && decl.ambiguity_vis_max.get().is_none() { // The source entity is too private to be reexported // with the given import declaration's visibility. diff --git a/tests/ui/imports/ambiguous-import-visibility-globglob-reexport.rs b/tests/ui/imports/ambiguous-import-visibility-globglob-reexport.rs new file mode 100644 index 0000000000000..25dd51141c936 --- /dev/null +++ b/tests/ui/imports/ambiguous-import-visibility-globglob-reexport.rs @@ -0,0 +1,16 @@ +// Regression test for issue #156264 + +//@ check-pass + +mod m_pub { + pub struct S {} +} + +mod m_crate { + pub(crate) use crate::m_pub::S; +} + +pub(crate) use m_crate::*; +pub use m_pub::*; + +fn main() {}