Skip to content

Commit b4834a1

Browse files
committed
rewrite resolve-rename in rmake
1 parent f989d2f commit b4834a1

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

src/tools/run-make-support/src/rustc.rs

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ impl Rustc {
7070
self
7171
}
7272

73+
/// Add a suffix in each output filename.
74+
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
75+
self.cmd.arg(format!("-Cextra-filename={suffix}"));
76+
self
77+
}
78+
7379
/// Specify type(s) of output files to generate.
7480
pub fn emit(&mut self, kinds: &str) -> &mut Self {
7581
self.cmd.arg(format!("--emit={kinds}"));

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ run-make/remap-path-prefix-dwarf/Makefile
216216
run-make/remap-path-prefix/Makefile
217217
run-make/reproducible-build-2/Makefile
218218
run-make/reproducible-build/Makefile
219-
run-make/resolve-rename/Makefile
220219
run-make/return-non-c-like-enum-from-c/Makefile
221220
run-make/return-non-c-like-enum/Makefile
222221
run-make/rlib-chain/Makefile

tests/run-make/resolve-rename/Makefile

-7
This file was deleted.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// If a library is compiled with -C extra-filename, the rust compiler
2+
// will take this into account when searching for libraries. However,
3+
// if that library is then renamed, the rust compiler should fall back
4+
// to its regular library location logic and not immediately fail to find
5+
// the renamed library.
6+
// See https://github.com/rust-lang/rust/pull/49253
7+
8+
use run_make_support::{rustc, tmp_dir};
9+
use std::fs;
10+
fn main() {
11+
rustc().extra_filename("-hash").input("foo.rs").run();
12+
rustc().input("bar.rs").run();
13+
fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"));
14+
rustc().input("baz.rs").run();
15+
}

0 commit comments

Comments
 (0)