Skip to content

Commit 6e3b505

Browse files
committed
Fix clang-cl treating file as a /U arg.
On MacOS, paths will likely start with /Users, but clang-cl treats /U as an argument, which leads to the source being mistaken for a flag. To avoid this, we can pass -- before the source to ensure argument parsing is disabled.
1 parent fba7fed commit 6e3b505

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,10 @@ impl Build {
13111311
if self.cuda && self.files.len() > 1 {
13121312
cmd.arg("--device-c");
13131313
}
1314+
// Ensure src is not treated as a clang-cl argument, like /U.
1315+
if compiler.family == (ToolFamily::Msvc { clang_cl: true }) {
1316+
cmd.arg("--");
1317+
}
13141318
cmd.arg(&obj.src);
13151319
if cfg!(target_os = "macos") {
13161320
self.fix_env_for_apple_os(&mut cmd)?;

0 commit comments

Comments
 (0)