@@ -128,11 +128,14 @@ impl<'r, 'a, 'tcx> EffectiveVisibilitiesVisitor<'r, 'a, 'tcx> {
128128 // If the binding is ambiguous, put the root ambiguity binding and all reexports
129129 // leading to it into the table. They are used by the `ambiguous_glob_reexports`
130130 // lint. For all bindings added to the table this way `is_ambiguity` returns true.
131+ let is_ambiguity =
132+ |binding : NameBinding < ' a > , warn : bool | binding. ambiguity . is_some ( ) && !warn;
131133 let mut parent_id = ParentId :: Def ( module_id) ;
134+ let mut warn_ambiguity = binding. warn_ambiguity ;
132135 while let NameBindingKind :: Import { binding : nested_binding, .. } = binding. kind {
133136 self . update_import ( binding, parent_id) ;
134137
135- if binding . ambiguity . is_some ( ) {
138+ if is_ambiguity ( binding , warn_ambiguity ) {
136139 // Stop at the root ambiguity, further bindings in the chain should not
137140 // be reexported because the root ambiguity blocks any access to them.
138141 // (Those further bindings are most likely not ambiguities themselves.)
@@ -141,9 +144,9 @@ impl<'r, 'a, 'tcx> EffectiveVisibilitiesVisitor<'r, 'a, 'tcx> {
141144
142145 parent_id = ParentId :: Import ( binding) ;
143146 binding = nested_binding;
147+ warn_ambiguity |= nested_binding. warn_ambiguity ;
144148 }
145-
146- if binding. ambiguity . is_none ( )
149+ if !is_ambiguity ( binding, warn_ambiguity)
147150 && let Some ( def_id) = binding. res ( ) . opt_def_id ( ) . and_then ( |id| id. as_local ( ) ) {
148151 self . update_def ( def_id, binding. vis . expect_local ( ) , parent_id) ;
149152 }
0 commit comments