@@ -96,13 +96,10 @@ impl<'a, 'ra, 'tcx> EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
9696 // is the maximum value among visibilities of declarations corresponding to that def id.
9797 for ( decl, eff_vis) in visitor. import_effective_visibilities . iter ( ) {
9898 let DeclKind :: Import { import, .. } = decl. kind else { unreachable ! ( ) } ;
99- if !decl. is_ambiguity_recursive ( ) {
100- if let Some ( node_id) = import. id ( ) {
101- r. effective_visibilities . update_eff_vis ( r. local_def_id ( node_id) , eff_vis, r. tcx )
102- }
103- } else if decl. ambiguity . get ( ) . is_some ( )
104- && eff_vis. is_public_at_level ( Level :: Reexported )
105- {
99+ if let Some ( node_id) = import. id ( ) {
100+ r. effective_visibilities . update_eff_vis ( r. local_def_id ( node_id) , eff_vis, r. tcx )
101+ }
102+ if decl. ambiguity . get ( ) . is_some ( ) && eff_vis. is_public_at_level ( Level :: Reexported ) {
106103 exported_ambiguities. insert ( * decl) ;
107104 }
108105 }
@@ -123,31 +120,13 @@ impl<'a, 'ra, 'tcx> EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
123120 // Set the given effective visibility level to `Level::Direct` and
124121 // sets the rest of the `use` chain to `Level::Reexported` until
125122 // we hit the actual exported item.
126- //
127- // If the binding is ambiguous, put the root ambiguity binding and all reexports
128- // leading to it into the table. They are used by the `ambiguous_glob_reexports`
129- // lint. For all bindings added to the table this way `is_ambiguity` returns true.
130- let is_ambiguity =
131- |decl : Decl < ' ra > , warn : bool | decl. ambiguity . get ( ) . is_some ( ) && !warn;
132123 let mut parent_id = ParentId :: Def ( module_id) ;
133- let mut warn_ambiguity = decl. warn_ambiguity . get ( ) ;
134124 while let DeclKind :: Import { source_decl, .. } = decl. kind {
135125 self . update_import ( decl, parent_id) ;
136-
137- if is_ambiguity ( decl, warn_ambiguity) {
138- // Stop at the root ambiguity, further bindings in the chain should not
139- // be reexported because the root ambiguity blocks any access to them.
140- // (Those further bindings are most likely not ambiguities themselves.)
141- break ;
142- }
143-
144126 parent_id = ParentId :: Import ( decl) ;
145127 decl = source_decl;
146- warn_ambiguity |= source_decl. warn_ambiguity . get ( ) ;
147128 }
148- if !is_ambiguity ( decl, warn_ambiguity)
149- && let Some ( def_id) = decl. res ( ) . opt_def_id ( ) . and_then ( |id| id. as_local ( ) )
150- {
129+ if let Some ( def_id) = decl. res ( ) . opt_def_id ( ) . and_then ( |id| id. as_local ( ) ) {
151130 self . update_def ( def_id, decl. vis ( ) . expect_local ( ) , parent_id) ;
152131 }
153132 }
0 commit comments