Skip to content

Commit

Permalink
Fix msvc stdout not shown on error (#1303)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
NobodyXu authored Nov 26, 2024
1 parent 1eefa74 commit f770d56
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,19 @@ impl Build {
cmd.push_cc_arg(warnings_to_errors_flag);
}

// Copied from <https://github.com/rust-lang/rust/blob/5db81020006d2920fc9c62ffc0f4322f90bffa04/compiler/rustc_codegen_ssa/src/back/linker.rs#L27-L38>
//
// 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)
}

Expand Down

0 comments on commit f770d56

Please sign in to comment.