Auto merge of #126861 - GuillaumeGomez:migrate-run-make-invalid-libra… · rust-lang/rust@2495953 (original) (raw)

File tree

6 files changed

lines changed

6 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -228,6 +228,12 @@ dependencies = [
228 228 "backtrace",
229 229 ]
230 230
231 +[[package]]
232 +name = "ar"
233 +version = "0.9.0"
234 +source = "registry+https://github.com/rust-lang/crates.io-index"
235 +checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69"
236 +
231 237 [[package]]
232 238 name = "ar_archive_writer"
233 239 version = "0.2.0"
@@ -3394,6 +3400,7 @@ dependencies = [
3394 3400 name = "run_make_support"
3395 3401 version = "0.2.0"
3396 3402 dependencies = [
3403 +"ar",
3397 3404 "gimli 0.28.1",
3398 3405 "object 0.34.0",
3399 3406 "regex",
Original file line number Diff line number Diff line change
@@ -9,3 +9,4 @@ similar = "2.5.0"
9 9 wasmparser = "0.118.2"
10 10 regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
11 11 gimli = "0.28.1"
12 +ar = "0.9.0"
Original file line number Diff line number Diff line change
@@ -61,6 +61,19 @@ pub fn target() -> String {
61 61 env_var("TARGET")
62 62 }
63 63
64 +/// `AR`
65 +#[track_caller]
66 +pub fn ar(inputs: &[impl AsRef<Path>], output_path: impl AsRef<Path>) {
67 +let output = fs::File::create(&output_path).expect(&format!(
68 +"the file in path \"{}\" could not be created",
69 + output_path.as_ref().display()
70 +));
71 +let mut builder = ar::Builder::new(output);
72 +for input in inputs {
73 + builder.append_path(input).unwrap();
74 +}
75 +}
76 +
64 77 /// Check if target is windows-like.
65 78 #[must_use]
66 79 pub fn is_windows() -> bool {
Original file line number Diff line number Diff line change
@@ -54,7 +54,6 @@ run-make/incr-add-rust-src-component/Makefile
54 54 run-make/incr-foreign-head-span/Makefile
55 55 run-make/interdependent-c-libraries/Makefile
56 56 run-make/intrinsic-unreachable/Makefile
57 -run-make/invalid-library/Makefile
58 57 run-make/issue-107094/Makefile
59 58 run-make/issue-109934-lto-debuginfo/Makefile
60 59 run-make/issue-14698/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1 +use run_make_support::fs_wrapper::create_file;
2 +use run_make_support::{ar, rustc};
3 +
4 +fn main() {
5 +create_file("lib.rmeta");
6 +ar(&["lib.rmeta"], "libfoo-ffffffff-1.0.rlib");
7 +rustc().input("foo.rs").run_fail().assert_stderr_contains("found invalid metadata");
8 +}