Skip to content

Commit 75981be

Browse files
committed
Adjusted zig cc judgment and avoided zigbuild errors(rust-lang#1360)
Adjusted is_zig_cc judgment and adjusted how supports_path_delimiter is handled.
1 parent a8c9dc0 commit 75981be

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ impl Build {
18001800
cmd.args(self.asm_flags.iter().map(std::ops::Deref::deref));
18011801
}
18021802

1803-
if compiler.supports_path_delimiter() && !is_assembler_msvc {
1803+
if compiler.supports_path_delimiter() && !is_assembler_msvc && matches!(compiler.family, ToolFamily::Clang { zig_cc: false }) {
18041804
// #513: For `clang-cl`, separate flags/options from the input file.
18051805
// When cross-compiling macOS -> Windows, this avoids interpreting
18061806
// common `/Users/...` paths as the `/U` flag and triggering

src/tool.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ impl Tool {
102102
cargo_output,
103103
)
104104
.map(|o| String::from_utf8_lossy(&o).contains("ziglang"))
105-
.unwrap_or_default()
105+
.unwrap_or_default() || {
106+
match path.file_name().map(OsStr::to_string_lossy) {
107+
Some(fname) => fname.contains("zig"),
108+
_ => false,
109+
}
110+
}
106111
}
107112

108113
fn guess_family_from_stdout(

0 commit comments

Comments
 (0)