Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9d3c23e

Browse files
committedJun 6, 2024
Auto merge of rust-lang#125736 - Oneirical:run-make-file-management, r=<try>
run-make-support: add helpers for `tmp_dir().join()` and `fs` operations Suggested by rust-lang#125728. The point of this wrapper is to stop silent fails caused by forgetting to `unwrap` `fs` functions. However, functions like `fs::read` which return something and get stored in a variable should cause a failure on their own if they are not unwrapped (as the `Result` will be stored in the variable, and something will be done on that `Result` that should have been done to its contents). Is it still pertinent to wrap `fs::read_to_string`, `fs::metadata` and so on? try-job: x86_64-msvc try-job: i686-mingw
2 parents e1ac0fa + c76d3b4 commit 9d3c23e

File tree

65 files changed

+339
-227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+339
-227
lines changed
 

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
use std::fs::remove_file;
77

88
use run_make_support::{
9-
cc, dynamic_lib_extension, is_msvc, read_dir, run, run_fail, rustc, tmp_dir,
9+
cc, dynamic_lib_extension, is_msvc, read_dir, rmake_out_dir, run, run_fail, rustc,
1010
};
1111

1212
fn main() {
1313
rustc().input("foo.rs").run();
1414

1515
if is_msvc() {
16-
let lib = tmp_dir().join("foo.dll.lib");
16+
let lib = rmake_out_dir().join("foo.dll.lib");
1717

1818
cc().input("bar.c").arg(lib).out_exe("bar").run();
1919
} else {
2020
cc().input("bar.c")
2121
.arg("-lfoo")
22-
.output(tmp_dir().join("bar"))
23-
.library_search_path(tmp_dir())
22+
.output(rmake_out_dir().join("bar"))
23+
.library_search_path(rmake_out_dir())
2424
.run();
2525
}
2626

2727
run("bar");
2828

2929
let expected_extension = dynamic_lib_extension();
30-
read_dir(tmp_dir(), |path| {
30+
read_dir(rmake_out_dir(), |path| {
3131
if path.is_file()
3232
&& path.extension().is_some_and(|ext| ext == expected_extension)
3333
&& path.file_name().and_then(|name| name.to_str()).is_some_and(|name| {

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

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

44
//@ ignore-cross-compile
55

6+
use run_make_support::fs_wrapper::remove_file;
67
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib};
78
use std::fs;
89

910
fn main() {
1011
rustc().input("foo.rs").run();
1112
cc().input("bar.c").input(static_lib("foo")).out_exe("bar").args(&extra_c_flags()).run();
1213
run("bar");
13-
fs::remove_file(static_lib("foo"));
14+
remove_file(static_lib("foo"));
1415
run("bar");
1516
}
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.