diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-05-29 18:00:14 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-05-29 18:00:14 +0200 |
| commit | 301d7229f706cbb95e78cd2319148bcbf22d80a1 (patch) | |
| tree | 96a2ebc3203d366138f8d5696124fd009fa1d555 | |
| parent | de1d0e0da9a93d2881b0416b05423c63488c2343 (diff) | |
| download | rust-301d7229f706cbb95e78cd2319148bcbf22d80a1.tar.gz rust-301d7229f706cbb95e78cd2319148bcbf22d80a1.zip | |
Add `run-make-support::rust_lib_name`
| -rw-r--r-- | src/tools/run-make-support/src/lib.rs | 8 | ||||
| -rw-r--r-- | tests/run-make/crate-data-smoke/rmake.rs | 6 |
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"), ); } |
