From 6d1a1cf354ef654c94839945f27b907804b203f2 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 11 May 2023 11:32:58 +0000 Subject: [PATCH] Fix symbol conflict diagnostic mistakenly being shown instead of missing crate diagnostic --- compiler/rustc_metadata/src/creader.rs | 10 +++++++--- compiler/rustc_metadata/src/locator.rs | 13 +++++++++++++ tests/run-make/issue-83045/Makefile | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 98ea9dc7501..209bf395624 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -148,11 +148,15 @@ fn intern_stable_crate_id(&mut self, root: &CrateRoot) -> Result), NonDylibPlugin(Symbol), + NotFound(Symbol), } enum MetadataError<'a> { @@ -1131,6 +1132,18 @@ pub(crate) fn report(self, sess: &Session, span: Span, missing_core: bool) { CrateError::NonDylibPlugin(crate_name) => { sess.emit_err(errors::NoDylibPlugin { span, crate_name }); } + CrateError::NotFound(crate_name) => { + sess.emit_err(errors::CannotFindCrate { + span, + crate_name, + add_info: String::new(), + missing_core, + current_crate: sess.opts.crate_name.clone().unwrap_or("".to_string()), + is_nightly_build: sess.is_nightly_build(), + profiler_runtime: Symbol::intern(&sess.opts.unstable_opts.profiler_runtime), + locator_triple: sess.opts.target_triple.clone(), + }); + } } } } diff --git a/tests/run-make/issue-83045/Makefile b/tests/run-make/issue-83045/Makefile index 7053da00f6b..b76e184b610 100644 --- a/tests/run-make/issue-83045/Makefile +++ b/tests/run-make/issue-83045/Makefile @@ -29,5 +29,5 @@ all: --crate-type=rlib \ --edition=2018 \ c.rs 2>&1 | tee $(TMPDIR)/output.txt || exit 0 - $(CGREP) E0519 < $(TMPDIR)/output.txt + $(CGREP) E0463 < $(TMPDIR)/output.txt $(CGREP) -v "internal compiler error" < $(TMPDIR)/output.txt