Skip to content

Commit 3e34771

Browse files
committed
Allow unused ambiguous glob imports.
1 parent 4712d18 commit 3e34771

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/librustc_resolve/resolve_imports.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,15 @@ impl<'a> NameResolution<'a> {
215215
self.binding.map(Success)
216216
}
217217

218-
fn report_conflicts<F: FnMut(&NameBinding, &NameBinding)>(&self, mut report: F) {
218+
fn report_conflicts<F: FnMut(&NameBinding, &NameBinding)>(&mut self, mut _report: F) {
219219
let binding = match self.binding {
220220
Some(binding) => binding,
221221
None => return,
222222
};
223223

224224
if !binding.defined_with(DefModifiers::GLOB_IMPORTED) { return }
225-
for duplicate_glob in self.duplicate_globs.iter() {
226-
report(duplicate_glob, binding);
227-
}
225+
let binding = &mut self.binding;
226+
self.duplicate_globs.iter().next().map(|_| *binding = None);
228227
}
229228
}
230229

@@ -686,7 +685,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
686685

687686
let mut reexports = Vec::new();
688687
for (&(name, ns), resolution) in module.resolutions.borrow().iter() {
689-
let resolution = resolution.borrow();
688+
let mut resolution = resolution.borrow_mut();
690689
resolution.report_conflicts(|b1, b2| {
691690
self.resolver.report_conflict(module, name, ns, b1, b2)
692691
});

0 commit comments

Comments
 (0)