Skip to content

Commit f770d56

Browse files
authored
Fix msvc stdout not shown on error (#1303)
* Fix msvc stdout not shown on error Fixed #1260 * Fix clippy lint * Call disable_localization unconditionally * Call disable_localization in try_get_compiler` * Set localization env based on msvc * Fix setting env * Fix fmt * Fix confusing wording in comment
1 parent 1eefa74 commit f770d56

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,19 @@ impl Build {
19501950
cmd.push_cc_arg(warnings_to_errors_flag);
19511951
}
19521952

1953+
// Copied from <https://github.com/rust-lang/rust/blob/5db81020006d2920fc9c62ffc0f4322f90bffa04/compiler/rustc_codegen_ssa/src/back/linker.rs#L27-L38>
1954+
//
1955+
// Disables non-English messages from localized linkers.
1956+
// Such messages may cause issues with text encoding on Windows
1957+
// and prevent inspection of msvc output in case of errors, which we occasionally do.
1958+
// This should be acceptable because other messages from rustc are in English anyway,
1959+
// and may also be desirable to improve searchability of the compiler diagnostics.
1960+
if matches!(cmd.family, ToolFamily::Msvc { clang_cl: false }) {
1961+
cmd.env.push(("VSLANG".into(), "1033".into()));
1962+
} else {
1963+
cmd.env.push(("LC_ALL".into(), "C".into()));
1964+
}
1965+
19531966
Ok(cmd)
19541967
}
19551968

0 commit comments

Comments
 (0)