Skip to content

Commit 9ba0afd

Browse files
committed
Move __fastfail termination diagnostic emission outside MSVC toolchain check to enable testing
Since the ui tests cannot satisfy the MSVC toolchain check - hence making this behavior untestable.
1 parent e60b967 commit 9ba0afd

File tree

1 file changed

+8
-7
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+8
-7
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,14 @@ fn link_natively(
872872
// is not a Microsoft LNK error then suggest a way to fix or
873873
// install the Visual Studio build tools.
874874
if let Some(code) = prog.status.code() {
875+
876+
// 0xc0000409 (`STATUS_STACK_BUFFER_OVERRUN`) is also used by `abort()` via `__fastfail` on Windows. Not necessarily a buffer overrun.
877+
// See <https://devblogs.microsoft.com/oldnewthing/20190108-00/?p=100655>
878+
const STATUS_STACK_BUFFER_OVERRUN: i32 = 0xC0000409u32 as i32; // = -1073740791
879+
if code == STATUS_STACK_BUFFER_OVERRUN {
880+
sess.dcx().emit_note(errors::LinkExeFastFailAbort);
881+
}
882+
875883
// All Microsoft `link.exe` linking ror codes are
876884
// four digit numbers in the range 1000 to 9999 inclusive
877885
if is_msvc_link_exe && (code < 1000 || code > 9999) {
@@ -881,13 +889,6 @@ fn link_natively(
881889

882890
sess.dcx().emit_note(errors::LinkExeUnexpectedError);
883891

884-
// 0xc0000409 (`STATUS_STACK_BUFFER_OVERRUN`) is also used by `abort()` via `__fastfail`. Not necessarily a buffer overrun.
885-
// See <https://devblogs.microsoft.com/oldnewthing/20190108-00/?p=100655>
886-
const STATUS_STACK_BUFFER_OVERRUN: i32 = 0xC0000409u32 as i32; // = -1073740791
887-
if code == STATUS_STACK_BUFFER_OVERRUN {
888-
sess.dcx().emit_note(errors::LinkExeFastFailAbort);
889-
}
890-
891892
if is_vs_installed && has_linker {
892893
// the linker is broken
893894
sess.dcx().emit_note(errors::RepairVSBuildTools);

0 commit comments

Comments
 (0)