From 5844b679f3289aa50fda5463667de1d63b7d41d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 7 Jun 2024 14:10:27 +0200 Subject: [PATCH] Remove unnecessary functions and the last mention of TMPDIR from `run-make-support` --- src/tools/run-make-support/src/lib.rs | 21 +------------------ .../arguments-non-c-like-enum/rmake.rs | 4 ++-- .../c-link-to-rust-staticlib/rmake.rs | 6 +++--- .../c-link-to-rust-va-list-fn/rmake.rs | 4 ++-- tests/run-make/cdylib/rmake.rs | 4 ++-- .../rmake.rs | 4 ++-- .../rustdoc-scrape-examples-macros/rmake.rs | 2 +- tests/run-make/suspicious-library/rmake.rs | 6 +++--- tests/run-make/wasm-abi/rmake.rs | 2 +- .../wasm-symbols-different-module/rmake.rs | 1 + 10 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index 79f732ecebb..e40f13f497b 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -65,12 +65,6 @@ pub fn is_darwin() -> bool { target().contains("darwin") } -/// Construct a path to a static library under `$TMPDIR` given the library name. This will return a -/// path with `$TMPDIR` joined with platform-and-compiler-specific library name. -pub fn static_lib(name: &str) -> PathBuf { - PathBuf::from(static_lib_name(name)) -} - pub fn python_command() -> Command { let python_path = env_var("PYTHON"); Command::new(python_path) @@ -111,12 +105,6 @@ pub fn static_lib_name(name: &str) -> String { if is_msvc() { format!("{name}.lib") } else { format!("lib{name}.a") } } -/// Construct a path to a dynamic library under `$TMPDIR` given the library name. This will return a -/// path with `$TMPDIR` joined with platform-and-compiler-specific library name. -pub fn dynamic_lib(name: &str) -> PathBuf { - PathBuf::from(dynamic_lib_name(name)) -} - /// Construct the dynamic library name based on the platform. pub fn dynamic_lib_name(name: &str) -> String { // See tools.mk (irrelevant lines omitted): @@ -154,14 +142,7 @@ pub fn dynamic_lib_extension() -> &'static str { } } -/// Construct a path to a rust library (rlib) under `$TMPDIR` given the library name. This will return a -/// path with `$TMPDIR` joined with the library name. -pub fn rust_lib(name: &str) -> PathBuf { - PathBuf::from(rust_lib_name(name)) -} - -/// Generate the name a rust library (rlib) would have. If you want the complete path, use -/// [`rust_lib`] instead. +/// Construct a rust library (rlib) name. pub fn rust_lib_name(name: &str) -> String { format!("lib{name}.rlib") } diff --git a/tests/run-make/arguments-non-c-like-enum/rmake.rs b/tests/run-make/arguments-non-c-like-enum/rmake.rs index 13230206ca8..88f4d664aa6 100644 --- a/tests/run-make/arguments-non-c-like-enum/rmake.rs +++ b/tests/run-make/arguments-non-c-like-enum/rmake.rs @@ -1,14 +1,14 @@ //! Check that non-trivial `repr(C)` enum in Rust has valid C layout. //@ ignore-cross-compile -use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib}; +use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name}; pub fn main() { use std::path::Path; rustc().input("nonclike.rs").crate_type("staticlib").run(); cc().input("test.c") - .input(static_lib("nonclike")) + .input(static_lib_name("nonclike")) .out_exe("test") .args(&extra_c_flags()) .args(&extra_cxx_flags()) diff --git a/tests/run-make/c-link-to-rust-staticlib/rmake.rs b/tests/run-make/c-link-to-rust-staticlib/rmake.rs index 63d5eb78c69..ca28944a026 100644 --- a/tests/run-make/c-link-to-rust-staticlib/rmake.rs +++ b/tests/run-make/c-link-to-rust-staticlib/rmake.rs @@ -3,13 +3,13 @@ //@ ignore-cross-compile -use run_make_support::{cc, extra_c_flags, run, rustc, static_lib}; +use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name}; use std::fs; fn main() { rustc().input("foo.rs").run(); - cc().input("bar.c").input(static_lib("foo")).out_exe("bar").args(&extra_c_flags()).run(); + cc().input("bar.c").input(static_lib_name("foo")).out_exe("bar").args(&extra_c_flags()).run(); run("bar"); - fs::remove_file(static_lib("foo")); + fs::remove_file(static_lib_name("foo")); run("bar"); } diff --git a/tests/run-make/c-link-to-rust-va-list-fn/rmake.rs b/tests/run-make/c-link-to-rust-va-list-fn/rmake.rs index 7a450efff94..a01e259bce0 100644 --- a/tests/run-make/c-link-to-rust-va-list-fn/rmake.rs +++ b/tests/run-make/c-link-to-rust-va-list-fn/rmake.rs @@ -5,12 +5,12 @@ //@ ignore-cross-compile -use run_make_support::{cc, extra_c_flags, run, rustc, static_lib}; +use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name}; fn main() { rustc().input("checkrust.rs").run(); cc().input("test.c") - .input(static_lib("checkrust")) + .input(static_lib_name("checkrust")) .out_exe("test") .args(&extra_c_flags()) .run(); diff --git a/tests/run-make/cdylib/rmake.rs b/tests/run-make/cdylib/rmake.rs index 1920f618473..81166867b79 100644 --- a/tests/run-make/cdylib/rmake.rs +++ b/tests/run-make/cdylib/rmake.rs @@ -12,7 +12,7 @@ use std::fs::remove_file; -use run_make_support::{cc, cwd, dynamic_lib, is_msvc, run, rustc}; +use run_make_support::{cc, cwd, dynamic_lib_name, is_msvc, run, rustc}; fn main() { rustc().input("bar.rs").run(); @@ -25,7 +25,7 @@ fn main() { } run("foo"); - remove_file(dynamic_lib("foo")).unwrap(); + remove_file(dynamic_lib_name("foo")).unwrap(); rustc().input("foo.rs").arg("-Clto").run(); run("foo"); diff --git a/tests/run-make/reachable-extern-fn-available-lto/rmake.rs b/tests/run-make/reachable-extern-fn-available-lto/rmake.rs index c7262b9461b..558444846fd 100644 --- a/tests/run-make/reachable-extern-fn-available-lto/rmake.rs +++ b/tests/run-make/reachable-extern-fn-available-lto/rmake.rs @@ -9,10 +9,10 @@ //@ ignore-cross-compile -use run_make_support::{cc, extra_c_flags, run, rustc, static_lib}; +use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name}; fn main() { - let libbar_path = static_lib("bar"); + let libbar_path = static_lib_name("bar"); rustc().input("foo.rs").crate_type("rlib").run(); rustc() .input("bar.rs") diff --git a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs index c99112b6e5f..a6d08f28cda 100644 --- a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs +++ b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs @@ -1,6 +1,6 @@ //@ ignore-cross-compile -use run_make_support::{htmldocck, rustc, rustdoc, rust_lib_name}; +use run_make_support::{htmldocck, rust_lib_name, rustc, rustdoc}; fn main() { let out_dir = "rustdoc"; diff --git a/tests/run-make/suspicious-library/rmake.rs b/tests/run-make/suspicious-library/rmake.rs index 9e91de70bfc..e789607482b 100644 --- a/tests/run-make/suspicious-library/rmake.rs +++ b/tests/run-make/suspicious-library/rmake.rs @@ -3,12 +3,12 @@ //@ ignore-cross-compile -use run_make_support::{dynamic_lib, rustc}; +use run_make_support::{dynamic_lib_name, rustc}; use std::fs::File; fn main() { rustc().input("foo.rs").arg("-Cprefer-dynamic").run(); - File::create(dynamic_lib("foo-something-special")).unwrap(); - File::create(dynamic_lib("foo-something-special2")).unwrap(); + File::create(dynamic_lib_name("foo-something-special")).unwrap(); + File::create(dynamic_lib_name("foo-something-special2")).unwrap(); rustc().input("bar.rs").run(); } diff --git a/tests/run-make/wasm-abi/rmake.rs b/tests/run-make/wasm-abi/rmake.rs index 8e90d83af6c..0fc326babd9 100644 --- a/tests/run-make/wasm-abi/rmake.rs +++ b/tests/run-make/wasm-abi/rmake.rs @@ -8,7 +8,7 @@ fn main() { rustc().input("foo.rs").target("wasm32-wasip1").run(); - let file = PathBuf::from("foo.wasm"); + let file = Path::new("foo.wasm"); run(&file, "return_two_i32", "1\n2\n"); run(&file, "return_two_i64", "3\n4\n"); diff --git a/tests/run-make/wasm-symbols-different-module/rmake.rs b/tests/run-make/wasm-symbols-different-module/rmake.rs index 4960827f151..83970ef0b24 100644 --- a/tests/run-make/wasm-symbols-different-module/rmake.rs +++ b/tests/run-make/wasm-symbols-different-module/rmake.rs @@ -2,6 +2,7 @@ use run_make_support::{rustc, wasmparser}; use std::collections::{HashMap, HashSet}; +use std::path::Path; fn main() { test_file("foo.rs", &[("a", &["foo"]), ("b", &["foo"])]);