Skip to content

Commit bfae41d

Browse files
committed
Fix ICE with use clippy::a::b;
1 parent 61edfd5 commit bfae41d

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

compiler/rustc_resolve/src/imports.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -955,14 +955,14 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
955955
}
956956
return None;
957957
}
958-
PathResult::NonModule(path_res) if path_res.base_res() == Res::Err => {
958+
PathResult::NonModule(_) => {
959959
if no_ambiguity {
960960
assert!(import.imported_module.get().is_none());
961961
}
962962
// The error was already reported earlier.
963963
return None;
964964
}
965-
PathResult::Indeterminate | PathResult::NonModule(..) => unreachable!(),
965+
PathResult::Indeterminate => unreachable!(),
966966
};
967967

968968
let (ident, target, source_bindings, target_bindings, type_ns_only) = match import.kind {

src/test/ui/imports/tool-mod-child.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use clippy::a; //~ ERROR unresolved import `clippy`
2+
use clippy::a::b; //~ ERROR failed to resolve: maybe a missing crate `clippy`?
3+
4+
use rustdoc::a; //~ ERROR unresolved import `rustdoc`
5+
use rustdoc::a::b; //~ ERROR failed to resolve: maybe a missing crate `rustdoc`?
6+
7+
fn main() {}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error[E0433]: failed to resolve: maybe a missing crate `clippy`?
2+
--> $DIR/tool-mod-child.rs:2:5
3+
|
4+
LL | use clippy::a::b;
5+
| ^^^^^^ maybe a missing crate `clippy`?
6+
7+
error[E0432]: unresolved import `clippy`
8+
--> $DIR/tool-mod-child.rs:1:5
9+
|
10+
LL | use clippy::a;
11+
| ^^^^^^ maybe a missing crate `clippy`?
12+
13+
error[E0433]: failed to resolve: maybe a missing crate `rustdoc`?
14+
--> $DIR/tool-mod-child.rs:5:5
15+
|
16+
LL | use rustdoc::a::b;
17+
| ^^^^^^^ maybe a missing crate `rustdoc`?
18+
19+
error[E0432]: unresolved import `rustdoc`
20+
--> $DIR/tool-mod-child.rs:4:5
21+
|
22+
LL | use rustdoc::a;
23+
| ^^^^^^^ maybe a missing crate `rustdoc`?
24+
25+
error: aborting due to 4 previous errors
26+
27+
Some errors have detailed explanations: E0432, E0433.
28+
For more information about an error, try `rustc --explain E0432`.

0 commit comments

Comments
 (0)