about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/tools/run-make-support/src/lib.rs8
-rw-r--r--tests/run-make/crate-data-smoke/rmake.rs6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index d96c8b89127..c7f48ad3f19 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -135,7 +135,13 @@ pub fn dynamic_lib_name(name: &str) -> String {
 /// 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 {
-    tmp_dir().join(format!("lib{name}.rlib"))
+    tmp_dir().join(rust_lib_name(name))
+}
+
+/// Generate the name a rust library (rlib) would have. If you want the complete path, use
+/// [`rust_lib`] instead.
+pub fn rust_lib_name(name: &str) -> String {
+    format!("lib{name}.rlib")
 }
 
 /// Construct the binary name based on platform.
diff --git a/tests/run-make/crate-data-smoke/rmake.rs b/tests/run-make/crate-data-smoke/rmake.rs
index 9c9b1c334c0..80d43903a53 100644
--- a/tests/run-make/crate-data-smoke/rmake.rs
+++ b/tests/run-make/crate-data-smoke/rmake.rs
@@ -1,6 +1,6 @@
 use std::process::Output;
 
-use run_make_support::{bin_name, rust_lib, rustc};
+use run_make_support::{bin_name, rust_lib_name, rustc};
 
 fn compare_stdout<S: AsRef<str>>(output: Output, expected: S) {
     assert_eq!(
@@ -34,10 +34,10 @@ fn main() {
     );
     compare_stdout(
         rustc().print("file-names").input("lib.rs").run(),
-        rust_lib("mylib").file_name().unwrap().to_string_lossy(),
+        rust_lib_name("mylib"),
     );
     compare_stdout(
         rustc().print("file-names").input("rlib.rs").run(),
-        rust_lib("mylib").file_name().unwrap().to_string_lossy(),
+        rust_lib_name("mylib"),
     );
 }