rewrite rmeta-preferred to rmake

This commit is contained in:
Oneirical 2024-06-19 15:46:27 -04:00
parent 5e23dfea9d
commit b167a15d64
5 changed files with 20 additions and 21 deletions

View File

@ -132,7 +132,6 @@ run-make/return-non-c-like-enum-from-c/Makefile
run-make/rlib-format-packed-bundled-libs-2/Makefile run-make/rlib-format-packed-bundled-libs-2/Makefile
run-make/rlib-format-packed-bundled-libs-3/Makefile run-make/rlib-format-packed-bundled-libs-3/Makefile
run-make/rlib-format-packed-bundled-libs/Makefile run-make/rlib-format-packed-bundled-libs/Makefile
run-make/rmeta-preferred/Makefile
run-make/rustc-macro-dep-files/Makefile run-make/rustc-macro-dep-files/Makefile
run-make/sanitizer-cdylib-link/Makefile run-make/sanitizer-cdylib-link/Makefile
run-make/sanitizer-dylib-link/Makefile run-make/sanitizer-dylib-link/Makefile

View File

@ -3,8 +3,6 @@
// and this test checks that this is still the case. // and this test checks that this is still the case.
// See https://github.com/rust-lang/rust/pull/24423 // See https://github.com/rust-lang/rust/pull/24423
//FIXME(Oneirical): check if works without ignore freebsd
use run_make_support::{invalid_utf8_contains, rustc}; use run_make_support::{invalid_utf8_contains, rustc};
fn main() { fn main() {

View File

@ -9,6 +9,6 @@
fn main() { fn main() {
rustc().input("baz.rs").emit("metadata").run(); rustc().input("baz.rs").emit("metadata").run();
rustc().input("bar.rs").emit("metadata").extern_("baz", "libbaz.rmeta").run(); rustc().input("bar.rs").emit("metadata").extern_("baz", "libbaz.rmeta").run();
// There should be no internal compiler error message. // There should be no internal compiler error.
rustc().input("foo.rs").emit("metadata").extern_("bar", "libbaz.rmeta").run().assert_stderr_not_contains("unexpectedly panicked"); rustc().input("foo.rs").emit("metadata").extern_("bar", "libbaz.rmeta").run();
} }

View File

@ -1,16 +0,0 @@
# ignore-cross-compile
include ../tools.mk
# Test that using rlibs and rmeta dep crates work together. Specifically, that
# there can be both an rmeta and an rlib file and rustc will prefer the rmeta
# file.
#
# This behavior is simply making sure this doesn't accidentally change; in this
# case we want to make sure that the rlib isn't being used as that would cause
# bugs in -Zbinary-dep-depinfo (see #68298).
all:
$(RUSTC) rmeta_aux.rs --crate-type=rlib --emit link,metadata
$(RUSTC) lib.rs --crate-type=rlib --emit dep-info -Zbinary-dep-depinfo
$(CGREP) "librmeta_aux.rmeta" < $(TMPDIR)/lib.d
$(CGREP) -v "librmeta_aux.rlib" < $(TMPDIR)/lib.d

View File

@ -0,0 +1,18 @@
// This test compiles `lib.rs`'s dependency, `rmeta_aux.rs`, as both an rlib
// and an rmeta crate. By default, rustc should give the metadata crate (rmeta)
// precedence over the rust-lib (rlib). This test inspects the contents of the binary
// and that the correct (rmeta) crate was used.
// rlibs being preferred could indicate a resurgence of the -Zbinary-dep-depinfo bug
// seen in #68298.
// See https://github.com/rust-lang/rust/pull/37681
//@ ignore-cross-compile
use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, rustc};
fn main() {
rustc().input("rmeta_aux.rs").crate_type("rlib").emit("link,metadata").run();
rustc().input("lib.rs").crate_type("rlib").emit("dep-info").arg("-Zbinary-dep-depinfo").run();
invalid_utf8_contains("lib.d", "librmeta_aux.rmeta");
invalid_utf8_not_contains("lib.d", "librmeta_aux.rlib");
}