mirror of https://github.com/rust-lang/rust.git
rewrite resolve-rename in rmake
This commit is contained in:
parent
f989d2f625
commit
b4834a1c98
|
@ -70,6 +70,12 @@ impl Rustc {
|
|||
self
|
||||
}
|
||||
|
||||
/// Add a suffix in each output filename.
|
||||
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
|
||||
self.cmd.arg(format!("-Cextra-filename={suffix}"));
|
||||
self
|
||||
}
|
||||
|
||||
/// Specify type(s) of output files to generate.
|
||||
pub fn emit(&mut self, kinds: &str) -> &mut Self {
|
||||
self.cmd.arg(format!("--emit={kinds}"));
|
||||
|
|
|
@ -216,7 +216,6 @@ run-make/remap-path-prefix-dwarf/Makefile
|
|||
run-make/remap-path-prefix/Makefile
|
||||
run-make/reproducible-build-2/Makefile
|
||||
run-make/reproducible-build/Makefile
|
||||
run-make/resolve-rename/Makefile
|
||||
run-make/return-non-c-like-enum-from-c/Makefile
|
||||
run-make/return-non-c-like-enum/Makefile
|
||||
run-make/rlib-chain/Makefile
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
include ../tools.mk
|
||||
|
||||
all:
|
||||
$(RUSTC) -C extra-filename=-hash foo.rs
|
||||
$(RUSTC) bar.rs
|
||||
mv $(TMPDIR)/libfoo-hash.rlib $(TMPDIR)/libfoo-another-hash.rlib
|
||||
$(RUSTC) baz.rs
|
|
@ -0,0 +1,15 @@
|
|||
// If a library is compiled with -C extra-filename, the rust compiler
|
||||
// will take this into account when searching for libraries. However,
|
||||
// if that library is then renamed, the rust compiler should fall back
|
||||
// to its regular library location logic and not immediately fail to find
|
||||
// the renamed library.
|
||||
// See https://github.com/rust-lang/rust/pull/49253
|
||||
|
||||
use run_make_support::{rustc, tmp_dir};
|
||||
use std::fs;
|
||||
fn main() {
|
||||
rustc().extra_filename("-hash").input("foo.rs").run();
|
||||
rustc().input("bar.rs").run();
|
||||
fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"));
|
||||
rustc().input("baz.rs").run();
|
||||
}
|
Loading…
Reference in New Issue