@@ -403,6 +403,23 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
403403 module_. increment_outstanding_references_for ( target, TypeNS ) ;
404404 }
405405
406+ match ( & value_result, & type_result) {
407+ ( & Indeterminate , _) | ( _, & Indeterminate ) => return Indeterminate ,
408+ ( & Failed ( _) , & Failed ( _) ) => {
409+ let children = target_module. children . borrow ( ) ;
410+ let names = children. keys ( ) . map ( |& ( ref name, _) | name) ;
411+ let lev_suggestion = match find_best_match_for_name ( names, & source. as_str ( ) , None ) {
412+ Some ( name) => format ! ( ". Did you mean to use `{}`?" , name) ,
413+ None => "" . to_owned ( ) ,
414+ } ;
415+ let msg = format ! ( "There is no `{}` in `{}`{}" ,
416+ source,
417+ module_to_string( target_module) , lev_suggestion) ;
418+ return Failed ( Some ( ( directive. span , msg) ) ) ;
419+ }
420+ _ => ( ) ,
421+ }
422+
406423 match ( & value_result, & type_result) {
407424 ( & Success ( name_binding) , _) if !name_binding. is_import ( ) &&
408425 directive. is_public &&
@@ -437,23 +454,6 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
437454 _ => { }
438455 }
439456
440- match ( & value_result, & type_result) {
441- ( & Indeterminate , _) | ( _, & Indeterminate ) => return Indeterminate ,
442- ( & Failed ( _) , & Failed ( _) ) => {
443- let children = target_module. children . borrow ( ) ;
444- let names = children. keys ( ) . map ( |& ( ref name, _) | name) ;
445- let lev_suggestion = match find_best_match_for_name ( names, & source. as_str ( ) , None ) {
446- Some ( name) => format ! ( ". Did you mean to use `{}`?" , name) ,
447- None => "" . to_owned ( ) ,
448- } ;
449- let msg = format ! ( "There is no `{}` in `{}`{}" ,
450- source,
451- module_to_string( target_module) , lev_suggestion) ;
452- return Failed ( Some ( ( directive. span , msg) ) ) ;
453- }
454- _ => ( ) ,
455- }
456-
457457 for & ( ns, result) in & [ ( ValueNS , & value_result) , ( TypeNS , & type_result) ] {
458458 if let Success ( binding) = * result {
459459 if !binding. defined_with ( DefModifiers :: IMPORTABLE ) {
0 commit comments