Skip to content

Commit 4cc3834

Browse files
committed
resolve: ensure compile failed when has dummy or ambiguous
1 parent 02f1f6a commit 4cc3834

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

compiler/rustc_resolve/src/imports.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -989,17 +989,17 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
989989
initial_binding.res()
990990
});
991991
let res = binding.res();
992+
if res == Res::Err || !this.ambiguity_errors.is_empty() {
993+
this.tcx
994+
.sess
995+
.delay_span_bug(import.span, "some error happened for an import");
996+
return;
997+
}
992998
if let Ok(initial_res) = initial_res {
993-
if res != initial_res
994-
&& this.ambiguity_errors.is_empty()
995-
&& res != Res::Err
996-
{
999+
if res != initial_res {
9971000
span_bug!(import.span, "inconsistent resolution for an import");
9981001
}
999-
} else if res != Res::Err
1000-
&& this.ambiguity_errors.is_empty()
1001-
&& this.privacy_errors.is_empty()
1002-
{
1002+
} else if this.privacy_errors.is_empty() {
10031003
this.tcx
10041004
.sess
10051005
.create_err(CannotDetermineImportResolution { span: import.span })

0 commit comments

Comments
 (0)