Skip to content

Commit 6ba35ce

Browse files
committed
Resolve: Fix an ICE that occurs when an identifier refers to an indeterminate import (i.e. one that is not resolved and not known to have failed)
1 parent 38e23e8 commit 6ba35ce

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/librustc_resolve/lib.rs

+4-18
Original file line numberDiff line numberDiff line change
@@ -1811,14 +1811,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
18111811
}
18121812
}
18131813

1814-
// Next, check the module's imports if necessary.
1815-
1816-
// If this is a search of all imports, we should be done with glob
1817-
// resolution at this point.
1818-
if name_search_type == PathSearch {
1819-
assert_eq!(module_.glob_count.get(), 0);
1820-
}
1821-
18221814
// Check the list of resolved imports.
18231815
let children = module_.import_resolutions.borrow();
18241816
match children.get(&name) {
@@ -2935,9 +2927,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
29352927
}
29362928
}
29372929

2938-
Indeterminate => {
2939-
panic!("unexpected indeterminate result");
2940-
}
2930+
Indeterminate => return BareIdentifierPatternUnresolved,
29412931
Failed(err) => {
29422932
match err {
29432933
Some((span, msg)) => {
@@ -3195,7 +3185,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
31953185
resolve_error(self, span, ResolutionError::FailedToResolve(&*msg));
31963186
return None;
31973187
}
3198-
Indeterminate => panic!("indeterminate unexpected"),
3188+
Indeterminate => return None,
31993189
Success((resulting_module, resulting_last_private)) => {
32003190
containing_module = resulting_module;
32013191
last_private = resulting_last_private;
@@ -3258,9 +3248,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
32583248
return None;
32593249
}
32603250

3261-
Indeterminate => {
3262-
panic!("indeterminate unexpected");
3263-
}
3251+
Indeterminate => return None,
32643252

32653253
Success((resulting_module, resulting_last_private)) => {
32663254
containing_module = resulting_module;
@@ -3355,9 +3343,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
33553343
}
33563344
}
33573345
}
3358-
Indeterminate => {
3359-
panic!("unexpected indeterminate result");
3360-
}
3346+
Indeterminate => None,
33613347
Failed(err) => {
33623348
debug!("(resolving item path by identifier in lexical scope) failed to resolve {}",
33633349
name);

0 commit comments

Comments
 (0)