@@ -96,11 +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 . is_some ( ) && eff_vis. is_public_at_level ( Level :: Reexported ) {
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 . is_some ( ) && eff_vis. is_public_at_level ( Level :: Reexported ) {
104103 exported_ambiguities. insert ( * decl) ;
105104 }
106105 }
@@ -121,30 +120,13 @@ impl<'a, 'ra, 'tcx> EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
121120 // Set the given effective visibility level to `Level::Direct` and
122121 // sets the rest of the `use` chain to `Level::Reexported` until
123122 // we hit the actual exported item.
124- //
125- // If the binding is ambiguous, put the root ambiguity binding and all reexports
126- // leading to it into the table. They are used by the `ambiguous_glob_reexports`
127- // lint. For all bindings added to the table this way `is_ambiguity` returns true.
128- let is_ambiguity = |decl : Decl < ' ra > , warn : bool | decl. ambiguity . is_some ( ) && !warn;
129123 let mut parent_id = ParentId :: Def ( module_id) ;
130- let mut warn_ambiguity = decl. warn_ambiguity ;
131124 while let DeclKind :: Import { source_decl, .. } = decl. kind {
132125 self . update_import ( decl, parent_id) ;
133-
134- if is_ambiguity ( decl, warn_ambiguity) {
135- // Stop at the root ambiguity, further bindings in the chain should not
136- // be reexported because the root ambiguity blocks any access to them.
137- // (Those further bindings are most likely not ambiguities themselves.)
138- break ;
139- }
140-
141126 parent_id = ParentId :: Import ( decl) ;
142127 decl = source_decl;
143- warn_ambiguity |= source_decl. warn_ambiguity ;
144128 }
145- if !is_ambiguity ( decl, warn_ambiguity)
146- && let Some ( def_id) = decl. res ( ) . opt_def_id ( ) . and_then ( |id| id. as_local ( ) )
147- {
129+ if let Some ( def_id) = decl. res ( ) . opt_def_id ( ) . and_then ( |id| id. as_local ( ) ) {
148130 self . update_def ( def_id, decl. vis . expect_local ( ) , parent_id) ;
149131 }
150132 }
0 commit comments