@@ -2058,7 +2058,8 @@ pub impl Resolver {
20582058 self . resolve_single_import ( module_,
20592059 containing_module,
20602060 target,
2061- source) ;
2061+ source,
2062+ import_directive. span ) ;
20622063 }
20632064 GlobImport => {
20642065 let span = import_directive. span ;
@@ -2121,7 +2122,8 @@ pub impl Resolver {
21212122 module_ : @mut Module ,
21222123 containing_module : @mut Module ,
21232124 target : ident ,
2124- source : ident )
2125+ source : ident ,
2126+ span : span )
21252127 -> ResolveResult < ( ) > {
21262128 debug ! ( "(resolving single import) resolving `%s` = `%s::%s` from \
21272129 `%s`",
@@ -2325,14 +2327,14 @@ pub impl Resolver {
23252327 }
23262328
23272329 if resolve_fail {
2328- self . session . err ( fmt ! ( "unresolved import: there is no `%s` in `%s`" ,
2329- * self . session. str_of( source) ,
2330- self . module_to_str( containing_module) ) ) ;
2330+ self . session . span_err ( span , fmt ! ( "unresolved import: there is no `%s` in `%s`" ,
2331+ * self . session. str_of( source) ,
2332+ self . module_to_str( containing_module) ) ) ;
23312333 return Failed ;
23322334 } else if priv_fail {
2333- self . session . err ( fmt ! ( "unresolved import: found `%s` in `%s` but it is private" ,
2334- * self . session. str_of( source) ,
2335- self . module_to_str( containing_module) ) ) ;
2335+ self . session . span_err ( span , fmt ! ( "unresolved import: found `%s` in `%s` but it is \
2336+ private" , * self . session. str_of( source) ,
2337+ self . module_to_str( containing_module) ) ) ;
23362338 return Failed ;
23372339 }
23382340
@@ -2593,7 +2595,18 @@ pub impl Resolver {
25932595 let start_index;
25942596 match module_prefix_result {
25952597 Failed => {
2596- self . session . span_err ( span, ~"unresolved name") ;
2598+ let mpath = self . idents_to_str ( module_path) ;
2599+ match str:: rfind ( self . idents_to_str ( module_path) , |c| { c == ':' } ) {
2600+ Some ( idx) => {
2601+ self . session . span_err ( span, fmt ! ( "unresolved import: could not find `%s` \
2602+ in `%s`", str :: substr( mpath, idx,
2603+ mpath. len( ) - idx) ,
2604+ // idx - 1 to account for the extra
2605+ // colon
2606+ str :: substr( mpath, 0 , idx - 1 ) ) ) ;
2607+ } ,
2608+ None => ( ) ,
2609+ } ;
25972610 return Failed ;
25982611 }
25992612 Indeterminate => {
0 commit comments