diff options
| -rw-r--r-- | src/librustc/middle/resolve.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index a50f78511cc..3f1bd2b9a3c 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -2596,11 +2596,17 @@ pub impl Resolver { match module_prefix_result { Failed => { let mpath = self.idents_to_str(module_path); - let idx = str::rfind(self.idents_to_str(module_path), |c| { c == ':' }).unwrap(); - self.session.span_err(span, fmt!("unresolved import: could not find `%s` in `%s`", - str::substr(mpath, idx, mpath.len() - idx), - // idx - 1 to account for the extra semicolon - str::substr(mpath, 0, idx - 1))); + match str::rfind(self.idents_to_str(module_path), |c| { c == ':' }) { + Some(idx) => { + self.session.span_err(span, fmt!("unresolved import: could not find `%s` \ + in `%s`", str::substr(mpath, idx, + mpath.len() - idx), + // idx - 1 to account for the extra + // colon + str::substr(mpath, 0, idx - 1))); + }, + None => (), + }; return Failed; } Indeterminate => { |
