From f768db6ba6d8415fab3bd51ec85ebf41f2209f7e Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 5 Jul 2024 15:07:15 -0400 Subject: [PATCH] rewrite and rename issue-83045 to rmake --- .../a.rs | 0 .../b.rs | 0 .../c.rs | 0 .../run-make/ice-dep-cannot-find-dep/rmake.rs | 39 +++++++++++++++++++ tests/run-make/issue-83045/Makefile | 33 ---------------- 5 files changed, 39 insertions(+), 33 deletions(-) rename tests/run-make/{issue-83045 => ice-dep-cannot-find-dep}/a.rs (100%) rename tests/run-make/{issue-83045 => ice-dep-cannot-find-dep}/b.rs (100%) rename tests/run-make/{issue-83045 => ice-dep-cannot-find-dep}/c.rs (100%) create mode 100644 tests/run-make/ice-dep-cannot-find-dep/rmake.rs delete mode 100644 tests/run-make/issue-83045/Makefile diff --git a/tests/run-make/issue-83045/a.rs b/tests/run-make/ice-dep-cannot-find-dep/a.rs similarity index 100% rename from tests/run-make/issue-83045/a.rs rename to tests/run-make/ice-dep-cannot-find-dep/a.rs diff --git a/tests/run-make/issue-83045/b.rs b/tests/run-make/ice-dep-cannot-find-dep/b.rs similarity index 100% rename from tests/run-make/issue-83045/b.rs rename to tests/run-make/ice-dep-cannot-find-dep/b.rs diff --git a/tests/run-make/issue-83045/c.rs b/tests/run-make/ice-dep-cannot-find-dep/c.rs similarity index 100% rename from tests/run-make/issue-83045/c.rs rename to tests/run-make/ice-dep-cannot-find-dep/c.rs diff --git a/tests/run-make/ice-dep-cannot-find-dep/rmake.rs b/tests/run-make/ice-dep-cannot-find-dep/rmake.rs new file mode 100644 index 00000000000..4256831a1ee --- /dev/null +++ b/tests/run-make/ice-dep-cannot-find-dep/rmake.rs @@ -0,0 +1,39 @@ +// This test case creates a situation where the crate loader would run +// into an ICE (internal compiler error) when confronted with an invalid setup where it cannot +// find the dependency of a direct dependency. +// +// The test case makes sure that the compiler produces the expected +// error message but does not ICE immediately after. +// +// See https://github.com/rust-lang/rust/issues/83045 + +//@ only-x86_64 +//@ only-linux +// Reason: This is a platform-independent issue, no need to waste time testing +// everywhere. + +// NOTE: We use `bare_rustc` below so that the compiler can't find liba.rlib +// If we used `rustc` the additional '-L rmake_out' option would allow rustc to +// actually find the crate. + +use run_make_support::{bare_rustc, fs_wrapper, rust_lib_name, rustc}; + +fn main() { + rustc().crate_name("a").crate_type("rlib").input("a.rs").arg("--verbose").run(); + rustc() + .crate_name("b") + .crate_type("rlib") + .extern_("a", rust_lib_name("a")) + .input("b.rs") + .arg("--verbose") + .run(); + fs_wrapper::create_dir("wrong_directory"); + bare_rustc() + .extern_("b", rust_lib_name("b")) + .crate_type("rlib") + .edition("2018") + .input("c.rs") + .run_fail() + .assert_stderr_contains("E0463") + .assert_stderr_not_contains("internal compiler error"); +} diff --git a/tests/run-make/issue-83045/Makefile b/tests/run-make/issue-83045/Makefile deleted file mode 100644 index b76e184b610..00000000000 --- a/tests/run-make/issue-83045/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../tools.mk - -# This test case creates a situation where the crate loader would run -# into an ICE when confronted with an invalid setup where it cannot -# find the dependency of a direct dependency. -# -# The test case makes sure that the compiler produces the expected -# error message but does not ICE immediately after. -# -# See https://github.com/rust-lang/rust/issues/83045 - -# This is a platform-independent issue, no need to waste time testing -# everywhere. -# only-x86_64 -# only-linux - -# NOTE: We use BARE_RUSTC below so that the compiler can't find liba.rlib -# If we used RUSTC the additional '-L TMPDIR' option would allow rustc to -# actually find the crate. -# -# We check that we get the expected error message -# But that we do not get an ICE - -all: - $(RUSTC) --crate-name=a --crate-type=rlib a.rs --verbose - $(RUSTC) --crate-name=b --crate-type=rlib --extern a=$(TMPDIR)/liba.rlib b.rs --verbose - $(BARE_RUSTC) --out-dir $(TMPDIR) \ - --extern b=$(TMPDIR)/libb.rlib \ - --crate-type=rlib \ - --edition=2018 \ - c.rs 2>&1 | tee $(TMPDIR)/output.txt || exit 0 - $(CGREP) E0463 < $(TMPDIR)/output.txt - $(CGREP) -v "internal compiler error" < $(TMPDIR)/output.txt