From 5e23dfea9dee65b8a5b7ed54354b4c46d38f12ca Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 19 Jun 2024 14:55:22 -0400 Subject: [PATCH] rewrite and rename issue-40535 to rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/issue-40535/Makefile | 13 ------------- .../bar.rs | 0 .../baz.rs | 0 .../foo.rs | 0 tests/run-make/metadata-only-crate-no-ice/rmake.rs | 14 ++++++++++++++ 6 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 tests/run-make/issue-40535/Makefile rename tests/run-make/{issue-40535 => metadata-only-crate-no-ice}/bar.rs (100%) rename tests/run-make/{issue-40535 => metadata-only-crate-no-ice}/baz.rs (100%) rename tests/run-make/{issue-40535 => metadata-only-crate-no-ice}/foo.rs (100%) create mode 100644 tests/run-make/metadata-only-crate-no-ice/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 4516bf86e2b3..4fbfa442fcc5 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -63,7 +63,6 @@ run-make/issue-33329/Makefile run-make/issue-35164/Makefile run-make/issue-36710/Makefile run-make/issue-37839/Makefile -run-make/issue-40535/Makefile run-make/issue-47551/Makefile run-make/issue-69368/Makefile run-make/issue-83045/Makefile diff --git a/tests/run-make/issue-40535/Makefile b/tests/run-make/issue-40535/Makefile deleted file mode 100644 index 155c88252144..000000000000 --- a/tests/run-make/issue-40535/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# The ICE occurred in the following situation: -# * `foo` declares `extern crate bar, baz`, depends only on `bar` (forgetting `baz` in `Cargo.toml`) -# * `bar` declares and depends on `extern crate baz` -# * All crates built in metadata-only mode (`cargo check`) -all: - # cc https://github.com/rust-lang/rust/issues/40623 - $(RUSTC) baz.rs --emit=metadata - $(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta - $(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta 2>&1 | \ - $(CGREP) -v "unexpectedly panicked" - # ^ Succeeds if it doesn't find the ICE message diff --git a/tests/run-make/issue-40535/bar.rs b/tests/run-make/metadata-only-crate-no-ice/bar.rs similarity index 100% rename from tests/run-make/issue-40535/bar.rs rename to tests/run-make/metadata-only-crate-no-ice/bar.rs diff --git a/tests/run-make/issue-40535/baz.rs b/tests/run-make/metadata-only-crate-no-ice/baz.rs similarity index 100% rename from tests/run-make/issue-40535/baz.rs rename to tests/run-make/metadata-only-crate-no-ice/baz.rs diff --git a/tests/run-make/issue-40535/foo.rs b/tests/run-make/metadata-only-crate-no-ice/foo.rs similarity index 100% rename from tests/run-make/issue-40535/foo.rs rename to tests/run-make/metadata-only-crate-no-ice/foo.rs diff --git a/tests/run-make/metadata-only-crate-no-ice/rmake.rs b/tests/run-make/metadata-only-crate-no-ice/rmake.rs new file mode 100644 index 000000000000..825da12cfd1b --- /dev/null +++ b/tests/run-make/metadata-only-crate-no-ice/rmake.rs @@ -0,0 +1,14 @@ +// In a dependency hierarchy, metadata-only crates could cause an Internal +// Compiler Error (ICE) due to a compiler bug - not correctly fetching sources for +// metadata-only crates. This test is a minimal reproduction of a program that triggered +// this bug, and checks that no ICE occurs. +// See https://github.com/rust-lang/rust/issues/40535 + +use run_make_support::rustc; + +fn main() { + rustc().input("baz.rs").emit("metadata").run(); + rustc().input("bar.rs").emit("metadata").extern_("baz", "libbaz.rmeta").run(); + // There should be no internal compiler error message. + rustc().input("foo.rs").emit("metadata").extern_("bar", "libbaz.rmeta").run().assert_stderr_not_contains("unexpectedly panicked"); +}