@@ -96,11 +96,10 @@ impl<'a, 'ra, 'tcx> EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
9696 // is the maximum value among visibilities of bindings corresponding to that def id.
9797 for ( binding, eff_vis) in visitor. import_effective_visibilities . iter ( ) {
9898 let NameBindingKind :: Import { import, .. } = binding. kind else { unreachable ! ( ) } ;
99- if !binding. 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 binding. 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 binding. ambiguity . is_some ( ) && eff_vis. is_public_at_level ( Level :: Reexported ) {
104103 exported_ambiguities. insert ( * binding) ;
105104 }
106105 }
@@ -121,31 +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 =
129- |binding : NameBinding < ' ra > , warn : bool | binding. ambiguity . is_some ( ) && !warn;
130123 let mut parent_id = ParentId :: Def ( module_id) ;
131- let mut warn_ambiguity = binding. warn_ambiguity ;
132124 while let NameBindingKind :: Import { binding : nested_binding, .. } = binding. kind {
133125 self . update_import ( binding, parent_id) ;
134-
135- if is_ambiguity ( binding, warn_ambiguity) {
136- // Stop at the root ambiguity, further bindings in the chain should not
137- // be reexported because the root ambiguity blocks any access to them.
138- // (Those further bindings are most likely not ambiguities themselves.)
139- break ;
140- }
141-
142126 parent_id = ParentId :: Import ( binding) ;
143127 binding = nested_binding;
144- warn_ambiguity |= nested_binding. warn_ambiguity ;
145128 }
146- if !is_ambiguity ( binding, warn_ambiguity)
147- && let Some ( def_id) = binding. res ( ) . opt_def_id ( ) . and_then ( |id| id. as_local ( ) )
148- {
129+ if let Some ( def_id) = binding. res ( ) . opt_def_id ( ) . and_then ( |id| id. as_local ( ) ) {
149130 self . update_def ( def_id, binding. vis . expect_local ( ) , parent_id) ;
150131 }
151132 }
0 commit comments