@@ -276,12 +276,6 @@ impl<'a> ::ModuleS<'a> {
276276 . increment_outstanding_references ( is_public) ;
277277 }
278278
279- fn decrement_outstanding_references_for ( & self , name : Name , ns : Namespace , is_public : bool ) {
280- self . update_resolution ( name, ns, |resolution| {
281- resolution. decrement_outstanding_references ( is_public) ;
282- } )
283- }
284-
285279 // Use `update` to mutate the resolution for the name.
286280 // If the resolution becomes a success, define it in the module's glob importers.
287281 fn update_resolution < T , F > ( & self , name : Name , ns : Namespace , update : F ) -> T
@@ -485,7 +479,8 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
485479 // Temporarily count the directive as determined so that the resolution fails
486480 // (as opposed to being indeterminate) when it can only be defined by the directive.
487481 if !determined {
488- module_. decrement_outstanding_references_for ( target, ns, directive. is_public )
482+ module_. resolutions . borrow_mut ( ) . get_mut ( & ( target, ns) ) . unwrap ( )
483+ . decrement_outstanding_references ( directive. is_public ) ;
489484 }
490485 let result =
491486 self . resolver . resolve_name_in_module ( target_module, source, ns, false , true ) ;
@@ -522,7 +517,10 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
522517 self . report_conflict ( target, ns, & directive. import ( binding, None ) , old_binding) ;
523518 }
524519 }
525- module_. decrement_outstanding_references_for ( target, ns, directive. is_public ) ;
520+
521+ module_. update_resolution ( target, ns, |resolution| {
522+ resolution. decrement_outstanding_references ( directive. is_public ) ;
523+ } )
526524 }
527525
528526 match ( & value_result, & type_result) {
0 commit comments