@@ -502,7 +502,11 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
502
502
None
503
503
} ;
504
504
505
- self . define ( module_, target, ns, directive. import ( binding, privacy_error) ) ;
505
+ let imported_binding = directive. import ( binding, privacy_error) ;
506
+ let conflict = module_. try_define_child ( target, ns, imported_binding) ;
507
+ if let Err ( old_binding) = conflict {
508
+ self . report_conflict ( target, ns, & directive. import ( binding, None ) , old_binding) ;
509
+ }
506
510
}
507
511
module_. decrement_outstanding_references_for ( target, ns) ;
508
512
}
@@ -613,7 +617,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
613
617
for ( & ( name, ns) , resolution) in target_module. resolutions . borrow ( ) . iter ( ) {
614
618
if let Some ( Success ( binding) ) = resolution. try_result ( ) {
615
619
if binding. defined_with ( DefModifiers :: IMPORTABLE | DefModifiers :: PUBLIC ) {
616
- self . define ( module_ , name, ns, directive. import ( binding, None ) ) ;
620
+ let _ = module_ . try_define_child ( name, ns, directive. import ( binding, None ) ) ;
617
621
}
618
622
}
619
623
}
@@ -631,16 +635,6 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
631
635
return Success ( ( ) ) ;
632
636
}
633
637
634
- fn define ( & mut self ,
635
- parent : Module < ' b > ,
636
- name : Name ,
637
- ns : Namespace ,
638
- binding : NameBinding < ' b > ) {
639
- if let Err ( old_binding) = parent. try_define_child ( name, ns, binding. clone ( ) ) {
640
- self . report_conflict ( name, ns, & binding, old_binding) ;
641
- }
642
- }
643
-
644
638
fn report_conflict ( & mut self ,
645
639
name : Name ,
646
640
ns : Namespace ,
0 commit comments