Skip to content

Commit

Permalink
fix(resolve): skip panic when resolution is dummy
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanjoi committed Jul 24, 2023
1 parent cb6ab95 commit 02f1f6a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
});
let res = binding.res();
if let Ok(initial_res) = initial_res {
if res != initial_res && this.ambiguity_errors.is_empty() {
if res != initial_res
&& this.ambiguity_errors.is_empty()
&& res != Res::Err
{
span_bug!(import.span, "inconsistent resolution for an import");
}
} else if res != Res::Err
Expand Down
6 changes: 6 additions & 0 deletions tests/ui/imports/issue-113953.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// edition: 2021
use u8 as imported_u8;
use unresolved as u8;
//~^ ERROR unresolved import `unresolved`

fn main() {}
9 changes: 9 additions & 0 deletions tests/ui/imports/issue-113953.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0432]: unresolved import `unresolved`
--> $DIR/issue-113953.rs:3:5
|
LL | use unresolved as u8;
| ^^^^^^^^^^^^^^^^ no external crate `unresolved`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.

0 comments on commit 02f1f6a

Please sign in to comment.