Auto merge of #113980 - bvanjoi:fix-113953, r=petrochenkov
fix(resolve): skip panic when resolution is dummy Fixes #113953 Skip the panic when the binding refers to a dummy node during the finalization. r? `@petrochenkov`
This commit is contained in:
commit
5b1dc9de77
3 changed files with 23 additions and 5 deletions
|
@ -989,14 +989,17 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
initial_binding.res()
|
initial_binding.res()
|
||||||
});
|
});
|
||||||
let res = binding.res();
|
let res = binding.res();
|
||||||
|
if res == Res::Err || !this.ambiguity_errors.is_empty() {
|
||||||
|
this.tcx
|
||||||
|
.sess
|
||||||
|
.delay_span_bug(import.span, "some error happened for an import");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if let Ok(initial_res) = initial_res {
|
if let Ok(initial_res) = initial_res {
|
||||||
if res != initial_res && this.ambiguity_errors.is_empty() {
|
if res != initial_res {
|
||||||
span_bug!(import.span, "inconsistent resolution for an import");
|
span_bug!(import.span, "inconsistent resolution for an import");
|
||||||
}
|
}
|
||||||
} else if res != Res::Err
|
} else if this.privacy_errors.is_empty() {
|
||||||
&& this.ambiguity_errors.is_empty()
|
|
||||||
&& this.privacy_errors.is_empty()
|
|
||||||
{
|
|
||||||
this.tcx
|
this.tcx
|
||||||
.sess
|
.sess
|
||||||
.create_err(CannotDetermineImportResolution { span: import.span })
|
.create_err(CannotDetermineImportResolution { span: import.span })
|
||||||
|
|
6
tests/ui/imports/issue-113953.rs
Normal file
6
tests/ui/imports/issue-113953.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
// edition: 2021
|
||||||
|
use u8 as imported_u8;
|
||||||
|
use unresolved as u8;
|
||||||
|
//~^ ERROR unresolved import `unresolved`
|
||||||
|
|
||||||
|
fn main() {}
|
9
tests/ui/imports/issue-113953.stderr
Normal file
9
tests/ui/imports/issue-113953.stderr
Normal file
|
@ -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`.
|
Loading…
Add table
Reference in a new issue