Skip to content

Commit 79850e7

Browse files
aidanhsluser
authored andcommitted
Make sure to correctly path-transform the input file
1 parent ed30cac commit 79850e7

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/compiler/rust.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -982,18 +982,30 @@ impl Compilation for RustCompilation {
982982
cwd: cwd.to_owned(),
983983
};
984984

985+
macro_rules! try_string_arg {
986+
($e:expr) => {
987+
match $e {
988+
Ok(s) => s,
989+
Err(e) => {
990+
debug!("Conversion failed for distributed compile argument: {}", e);
991+
return None
992+
},
993+
}
994+
};
995+
}
985996
let dist_command = (|| {
986997
let mut dist_arguments = vec![];
987998
// flat_map would be nice but the lifetimes don't work out
988999
for argument in arguments.iter() {
989-
for string_arg in argument.iter_strings(|p| path_transformer.to_dist(p)) {
990-
dist_arguments.push(match string_arg {
991-
Ok(s) => s,
992-
Err(e) => {
993-
debug!("Conversion failed for distributed compile argument: {}", e);
994-
return None
995-
},
996-
})
1000+
let path_transformer_fn = &mut |p: &Path| path_transformer.to_dist(p);
1001+
if let Argument::Raw(input_path) = argument {
1002+
// Need to explicitly handle the input argument as it's not parsed as a path
1003+
let input_path = Path::new(input_path).to_owned();
1004+
dist_arguments.push(try_string_arg!(input_path.into_arg_string(path_transformer_fn)))
1005+
} else {
1006+
for string_arg in argument.iter_strings(path_transformer_fn) {
1007+
dist_arguments.push(try_string_arg!(string_arg))
1008+
}
9971009
}
9981010
}
9991011

0 commit comments

Comments
 (0)