rewrite crate-name-priority to rmake · rust-lang/rust@3c0a4bc

4 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -16,7 +16,6 @@ run-make/compiler-lookup-paths/Makefile

1616

run-make/compiler-rt-works-on-mingw/Makefile

1717

run-make/compressed-debuginfo/Makefile

1818

run-make/crate-hash-rustc-version/Makefile

19-

run-make/crate-name-priority/Makefile

2019

run-make/cross-lang-lto-clang/Makefile

2120

run-make/cross-lang-lto-pgo-smoketest/Makefile

2221

run-make/cross-lang-lto-upstream-rlibs/Makefile

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,18 @@

1+

// The `crate_name` rustc flag should have higher priority

2+

// over `#![crate_name = "foo"]` defined inside the source code.

3+

// This test has a conflict between crate_names defined in the .rs files

4+

// and the compiler flags, and checks that the flag is favoured each time.

5+

// See https://github.com/rust-lang/rust/pull/15518

6+
7+

use run_make_support::{bin_name, fs_wrapper, rustc};

8+
9+

fn main() {

10+

rustc().input("foo.rs").run();

11+

fs_wrapper::remove_file(bin_name("foo"));

12+

rustc().input("foo.rs").crate_name("bar").run();

13+

fs_wrapper::remove_file(bin_name("bar"));

14+

rustc().input("foo1.rs").run();

15+

fs_wrapper::remove_file(bin_name("foo"));

16+

rustc().input("foo1.rs").output(bin_name("bar1")).run();

17+

fs_wrapper::remove_file(bin_name("bar1"));

18+

}

Original file line numberDiff line numberDiff line change

@@ -9,8 +9,6 @@

99

use run_make_support::{run, rustc};

1010
1111

fn main() {

12-

// FIXME(Oneirical): This first one will likely fail on MSVC due to #28026.

13-

// Remove this after try-job

1412

rustc().arg("-Crelocation-model=static").input("foo.rs").run();

1513

run("foo");

1614

rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run();