Skip to content

Commit 5fa0d5e

Browse files
committed
transpile: set -o explicitly for rustc in snapshot tests
Since `-o /dev/null` doesn't work since intermediates are created in the same directly, we compile to the normal `.rlib` output path and then delete it. This just makes that explicit with `-o` so it's more obviously correct, and we can name the `.rlib` anything we want as well.
1 parent 4eb2493 commit 5fa0d5e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

c2rust-transpile/tests/snapshots.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@ fn transpile(platform: Option<&str>, c_path: &Path) {
6969

7070
insta::assert_snapshot!(name, &rs, &debug_expr);
7171

72-
let status = Command::new("rustc")
73-
.args(&["--crate-type", "lib", "--edition", "2021"])
74-
.arg(&rs_path)
75-
.status();
76-
assert!(status.unwrap().success());
7772
let rlib_path = {
7873
let mut file_name = OsString::new();
7974
file_name.push("lib");
8075
file_name.push(rs_path.file_stem().unwrap());
8176
file_name.push(".rlib");
8277
PathBuf::from(file_name)
8378
};
79+
let status = Command::new("rustc")
80+
.args(&["--crate-type", "lib", "--edition", "2021", "-o"])
81+
.args(&[&rlib_path, &rs_path])
82+
.status();
83+
assert!(status.unwrap().success());
8484
fs::remove_file(&rlib_path).unwrap();
8585
}
8686

0 commit comments

Comments
 (0)