diff --git a/src/lib.rs b/src/lib.rs index 187eb705..da1b91be 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1950,6 +1950,19 @@ impl Build { cmd.push_cc_arg(warnings_to_errors_flag); } + // Copied from + // + // Disables non-English messages from localized linkers. + // Such messages may cause issues with text encoding on Windows + // and prevent inspection of msvc output in case of errors, which we occasionally do. + // This should be acceptable because other messages from rustc are in English anyway, + // and may also be desirable to improve searchability of the compiler diagnostics. + if matches!(cmd.family, ToolFamily::Msvc { clang_cl: false }) { + cmd.env.push(("VSLANG".into(), "1033".into())); + } else { + cmd.env.push(("LC_ALL".into(), "C".into())); + } + Ok(cmd) }