Skip to content

Commit f940b04

Browse files
committed
Fix run-pass tests when CARGO_TARGET_DIR is not set
1 parent c066807 commit f940b04

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/cargo/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use cargo_metadata::MetadataCommand;
12
use lazy_static::lazy_static;
23
use std::env;
34
use std::path::PathBuf;
@@ -6,7 +7,7 @@ lazy_static! {
67
pub static ref CARGO_TARGET_DIR: PathBuf = {
78
match env::var_os("CARGO_TARGET_DIR") {
89
Some(v) => v.into(),
9-
None => "target".into(),
10+
None => MetadataCommand::new().exec().unwrap().target_directory,
1011
}
1112
};
1213
pub static ref TARGET_LIB: PathBuf = {

0 commit comments

Comments
 (0)