Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Mar 13, 2016
1 parent fa18403 commit 9ca3ff1
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,6 @@ impl<'a> ::ModuleS<'a> {
.increment_outstanding_references(is_public);
}

fn decrement_outstanding_references_for(&self, name: Name, ns: Namespace, is_public: bool) {
self.update_resolution(name, ns, |resolution| {
resolution.decrement_outstanding_references(is_public);
})
}

// Use `update` to mutate the resolution for the name.
// If the resolution becomes a success, define it in the module's glob importers.
fn update_resolution<T, F>(&self, name: Name, ns: Namespace, update: F) -> T
Expand Down Expand Up @@ -485,7 +479,8 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
// Temporarily count the directive as determined so that the resolution fails
// (as opposed to being indeterminate) when it can only be defined by the directive.
if !determined {
module_.decrement_outstanding_references_for(target, ns, directive.is_public)
module_.resolutions.borrow_mut().get_mut(&(target, ns)).unwrap()
.decrement_outstanding_references(directive.is_public);
}
let result =
self.resolver.resolve_name_in_module(target_module, source, ns, false, true);
Expand Down Expand Up @@ -522,7 +517,10 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
self.report_conflict(target, ns, &directive.import(binding, None), old_binding);
}
}
module_.decrement_outstanding_references_for(target, ns, directive.is_public);

module_.update_resolution(target, ns, |resolution| {
resolution.decrement_outstanding_references(directive.is_public);
})
}

match (&value_result, &type_result) {
Expand Down

0 comments on commit 9ca3ff1

Please sign in to comment.