Skip to content

Commit 74625e1

Browse files
committed
Better error reporting with renaming imports
1 parent 7d81c80 commit 74625e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/librustc/middle/resolve.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2593,7 +2593,12 @@ pub impl Resolver {
25932593
let start_index;
25942594
match module_prefix_result {
25952595
Failed => {
2596-
self.session.span_err(span, ~"unresolved name");
2596+
let mpath = self.idents_to_str(module_path);
2597+
let idx = str::rfind(self.idents_to_str(module_path), |c| { c == ':' }).unwrap();
2598+
self.session.span_err(span, fmt!("unresolved import: could not find `%s` in `%s`",
2599+
str::substr(mpath, idx, mpath.len() - idx),
2600+
// idx - 1 to account for the extra semicolon
2601+
str::substr(mpath, 0, idx - 1)));
25972602
return Failed;
25982603
}
25992604
Indeterminate => {

0 commit comments

Comments
 (0)