Skip to content

Commit 235fa6b

Browse files
committed
resolve: Fix a false positive "cannot reexport" error for ambiguous glob sets
1 parent f95f341 commit 235fa6b

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

compiler/rustc_resolve/src/imports.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
822822
for decl in [resolution.non_glob_decl, resolution.glob_decl] {
823823
if let Some(decl) = decl
824824
&& let DeclKind::Import { source_decl, import } = decl.kind
825+
// FIXME: Do not check visibility-ambiguous imports for now. To check them
826+
// properly we need to preserve all imports in ambiguous glob sets and
827+
// check them all individually.
828+
&& decl.ambiguity_vis_max.get().is_none()
825829
{
826830
// The source entity is too private to be reexported
827831
// with the given import declaration's visibility.

tests/ui/imports/ambiguous-import-visibility-globglob-reexport.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Regression test for issue #156264
22

3+
//@ check-pass
4+
35
mod m_pub {
46
pub struct S {}
57
}
@@ -9,7 +11,6 @@ mod m_crate {
911
}
1012

1113
pub(crate) use m_crate::*;
12-
//~^ ERROR `S` is only public within the crate, and cannot be re-exported outside
1314
pub use m_pub::*;
1415

1516
fn main() {}

tests/ui/imports/ambiguous-import-visibility-globglob-reexport.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)