Skip to content

Commit 8a69dba

Browse files
committed
Fix ICE
1 parent 3bfc1ca commit 8a69dba

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/librustc/middle/resolve.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,11 +2596,17 @@ pub impl Resolver {
25962596
match module_prefix_result {
25972597
Failed => {
25982598
let mpath = self.idents_to_str(module_path);
2599-
let idx = str::rfind(self.idents_to_str(module_path), |c| { c == ':' }).unwrap();
2600-
self.session.span_err(span, fmt!("unresolved import: could not find `%s` in `%s`",
2601-
str::substr(mpath, idx, mpath.len() - idx),
2602-
// idx - 1 to account for the extra semicolon
2603-
str::substr(mpath, 0, idx - 1)));
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+
};
26042610
return Failed;
26052611
}
26062612
Indeterminate => {

0 commit comments

Comments
 (0)