Skip to content

Commit ca583cb

Browse files
committed
Remove unnecessary functions and the last mention of TMPDIR from run-make-support
1 parent c9cb328 commit ca583cb

File tree

8 files changed

+16
-35
lines changed

8 files changed

+16
-35
lines changed

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

+1-20
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ pub fn is_darwin() -> bool {
6565
target().contains("darwin")
6666
}
6767

68-
/// Construct a path to a static library under `$TMPDIR` given the library name. This will return a
69-
/// path with `$TMPDIR` joined with platform-and-compiler-specific library name.
70-
pub fn static_lib(name: &str) -> PathBuf {
71-
PathBuf::from(static_lib_name(name))
72-
}
73-
7468
pub fn python_command() -> Command {
7569
let python_path = env_var("PYTHON");
7670
Command::new(python_path)
@@ -111,12 +105,6 @@ pub fn static_lib_name(name: &str) -> String {
111105
if is_msvc() { format!("{name}.lib") } else { format!("lib{name}.a") }
112106
}
113107

114-
/// Construct a path to a dynamic library under `$TMPDIR` given the library name. This will return a
115-
/// path with `$TMPDIR` joined with platform-and-compiler-specific library name.
116-
pub fn dynamic_lib(name: &str) -> PathBuf {
117-
PathBuf::from(dynamic_lib_name(name))
118-
}
119-
120108
/// Construct the dynamic library name based on the platform.
121109
pub fn dynamic_lib_name(name: &str) -> String {
122110
// See tools.mk (irrelevant lines omitted):
@@ -154,14 +142,7 @@ pub fn dynamic_lib_extension() -> &'static str {
154142
}
155143
}
156144

157-
/// Construct a path to a rust library (rlib) under `$TMPDIR` given the library name. This will return a
158-
/// path with `$TMPDIR` joined with the library name.
159-
pub fn rust_lib(name: &str) -> PathBuf {
160-
PathBuf::from(rust_lib_name(name))
161-
}
162-
163-
/// Generate the name a rust library (rlib) would have. If you want the complete path, use
164-
/// [`rust_lib`] instead.
145+
/// Construct a rust library (rlib) name.
165146
pub fn rust_lib_name(name: &str) -> String {
166147
format!("lib{name}.rlib")
167148
}

tests/run-make/arguments-non-c-like-enum/rmake.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//! Check that non-trivial `repr(C)` enum in Rust has valid C layout.
22
//@ ignore-cross-compile
33

4-
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib};
4+
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};
55

66
pub fn main() {
77
use std::path::Path;
88

99
rustc().input("nonclike.rs").crate_type("staticlib").run();
1010
cc().input("test.c")
11-
.input(static_lib("nonclike"))
11+
.input(static_lib_name("nonclike"))
1212
.out_exe("test")
1313
.args(&extra_c_flags())
1414
.args(&extra_cxx_flags())

tests/run-make/c-link-to-rust-staticlib/rmake.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
//@ ignore-cross-compile
55

6-
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib};
6+
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};
77
use std::fs;
88

99
fn main() {
1010
rustc().input("foo.rs").run();
11-
cc().input("bar.c").input(static_lib("foo")).out_exe("bar").args(&extra_c_flags()).run();
11+
cc().input("bar.c").input(static_lib_name("foo")).out_exe("bar").args(&extra_c_flags()).run();
1212
run("bar");
13-
fs::remove_file(static_lib("foo"));
13+
fs::remove_file(static_lib_name("foo"));
1414
run("bar");
1515
}

tests/run-make/c-link-to-rust-va-list-fn/rmake.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
//@ ignore-cross-compile
77

8-
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib};
8+
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};
99

1010
fn main() {
1111
rustc().input("checkrust.rs").run();
1212
cc().input("test.c")
13-
.input(static_lib("checkrust"))
13+
.input(static_lib_name("checkrust"))
1414
.out_exe("test")
1515
.args(&extra_c_flags())
1616
.run();

tests/run-make/cdylib/rmake.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
use std::fs::remove_file;
1414

15-
use run_make_support::{cc, cwd, dynamic_lib, is_msvc, run, rustc};
15+
use run_make_support::{cc, cwd, dynamic_lib_name, is_msvc, run, rustc};
1616

1717
fn main() {
1818
rustc().input("bar.rs").run();
@@ -25,7 +25,7 @@ fn main() {
2525
}
2626

2727
run("foo");
28-
remove_file(dynamic_lib("foo")).unwrap();
28+
remove_file(dynamic_lib_name("foo")).unwrap();
2929

3030
rustc().input("foo.rs").arg("-Clto").run();
3131
run("foo");

tests/run-make/reachable-extern-fn-available-lto/rmake.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
//@ ignore-cross-compile
1111

12-
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib};
12+
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};
1313

1414
fn main() {
15-
let libbar_path = static_lib("bar");
15+
let libbar_path = static_lib_name("bar");
1616
rustc().input("foo.rs").crate_type("rlib").run();
1717
rustc()
1818
.input("bar.rs")

tests/run-make/rustdoc-scrape-examples-macros/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ ignore-cross-compile
22

3-
use run_make_support::{htmldocck, rustc, rustdoc, rust_lib_name};
3+
use run_make_support::{htmldocck, rust_lib_name, rustc, rustdoc};
44

55
fn main() {
66
let out_dir = "rustdoc";

tests/run-make/suspicious-library/rmake.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
//@ ignore-cross-compile
55

6-
use run_make_support::{dynamic_lib, rustc};
6+
use run_make_support::{dynamic_lib_name, rustc};
77
use std::fs::File;
88

99
fn main() {
1010
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
11-
File::create(dynamic_lib("foo-something-special")).unwrap();
12-
File::create(dynamic_lib("foo-something-special2")).unwrap();
11+
File::create(dynamic_lib_name("foo-something-special")).unwrap();
12+
File::create(dynamic_lib_name("foo-something-special2")).unwrap();
1313
rustc().input("bar.rs").run();
1414
}

0 commit comments

Comments
 (0)