diff options
| author | bohan <bohan-zhang@foxmail.com> | 2023-07-25 01:57:12 +0800 |
|---|---|---|
| committer | bohan <bohan-zhang@foxmail.com> | 2023-07-25 01:57:12 +0800 |
| commit | 4cc3834a5ced7ed5bc5c63d283c8a5b23fb9ccf6 (patch) | |
| tree | 6586b92f9de8493281ec28f5c5c49c2e5660fdb2 | |
| parent | 02f1f6a8a893bbaabc87079a61815685b0f88d75 (diff) | |
| download | rust-4cc3834a5ced7ed5bc5c63d283c8a5b23fb9ccf6.tar.gz rust-4cc3834a5ced7ed5bc5c63d283c8a5b23fb9ccf6.zip | |
resolve: ensure compile failed when has dummy or ambiguous
| -rw-r--r-- | compiler/rustc_resolve/src/imports.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index f18aedd190f..f3cf61c5b93 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -989,17 +989,17 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { initial_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 res != initial_res - && this.ambiguity_errors.is_empty() - && res != Res::Err - { + if res != initial_res { span_bug!(import.span, "inconsistent resolution for an import"); } - } else if res != Res::Err - && this.ambiguity_errors.is_empty() - && this.privacy_errors.is_empty() - { + } else if this.privacy_errors.is_empty() { this.tcx .sess .create_err(CannotDetermineImportResolution { span: import.span }) |
