rewrite crate-name-priority to rmake

This commit is contained in:
Oneirical 2024-06-19 16:52:36 -04:00
parent f22b5afa6a
commit 3c0a4bc915
4 changed files with 18 additions and 15 deletions

View File

@ -16,7 +16,6 @@ run-make/compiler-lookup-paths/Makefile
run-make/compiler-rt-works-on-mingw/Makefile run-make/compiler-rt-works-on-mingw/Makefile
run-make/compressed-debuginfo/Makefile run-make/compressed-debuginfo/Makefile
run-make/crate-hash-rustc-version/Makefile run-make/crate-hash-rustc-version/Makefile
run-make/crate-name-priority/Makefile
run-make/cross-lang-lto-clang/Makefile run-make/cross-lang-lto-clang/Makefile
run-make/cross-lang-lto-pgo-smoketest/Makefile run-make/cross-lang-lto-pgo-smoketest/Makefile
run-make/cross-lang-lto-upstream-rlibs/Makefile run-make/cross-lang-lto-upstream-rlibs/Makefile

View File

@ -1,12 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all:
$(RUSTC) foo.rs
rm $(TMPDIR)/$(call BIN,foo)
$(RUSTC) foo.rs --crate-name bar
rm $(TMPDIR)/$(call BIN,bar)
$(RUSTC) foo1.rs
rm $(TMPDIR)/$(call BIN,foo)
$(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1)
rm $(TMPDIR)/$(call BIN,bar1)

View File

@ -0,0 +1,18 @@
// The `crate_name` rustc flag should have higher priority
// over `#![crate_name = "foo"]` defined inside the source code.
// This test has a conflict between crate_names defined in the .rs files
// and the compiler flags, and checks that the flag is favoured each time.
// See https://github.com/rust-lang/rust/pull/15518
use run_make_support::{bin_name, fs_wrapper, rustc};
fn main() {
rustc().input("foo.rs").run();
fs_wrapper::remove_file(bin_name("foo"));
rustc().input("foo.rs").crate_name("bar").run();
fs_wrapper::remove_file(bin_name("bar"));
rustc().input("foo1.rs").run();
fs_wrapper::remove_file(bin_name("foo"));
rustc().input("foo1.rs").output(bin_name("bar1")).run();
fs_wrapper::remove_file(bin_name("bar1"));
}

View File

@ -9,8 +9,6 @@
use run_make_support::{run, rustc}; use run_make_support::{run, rustc};
fn main() { fn main() {
// FIXME(Oneirical): This first one will likely fail on MSVC due to #28026.
// Remove this after try-job
rustc().arg("-Crelocation-model=static").input("foo.rs").run(); rustc().arg("-Crelocation-model=static").input("foo.rs").run();
run("foo"); run("foo");
rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run(); rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run();