Skip to content

Fix Rust MSVC debug CRT mismatch - #895

Merged
Matthew Parkinson (mjp41) merged 2 commits into
microsoft:mainfrom
DamoyY:fix/rust-msvc-crt-debug
Nov 2, 2026
Merged

Matthew Parkinson (mjp41) merged 2 commits into
microsoft:mainfrom
DamoyY:fix/rust-msvc-crt-debug

Conversation

@DamoyY

@DamoyY Damoy (DamoyY) commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #894

Summary

  • Match CRT selection to Rust's crt-static target feature.
  • Keep the release CRT flavor in snmalloc Debug builds so Rust's MSVC debug profile does not link MSVCRTD.
  • Stop emitting an msvcrtd link directive for Rust MSVC builds.

Testing

  • cargo test --manifest-path snmalloc-rs/Cargo.toml --all
  • Windows MSVC debug build with the default dynamic CRT.
  • Windows MSVC debug build with crt-static enabled.

Both complete without LNK4098.

@DamoyY

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the changes aligning snmalloc’s Windows CRT selection with Rust.

No open issues 🎉

What changed in this PR

Fixes #894 by aligning snmalloc’s Windows MSVC runtime selection with Rust, avoiding mixed debug and release CRTs in Rust debug builds.

Changes:

  • Selects static or dynamic CRT linking based on Rust’s crt-static target feature.
  • Keeps CMake Debug builds on the release CRT and removes explicit msvcrtd linking.
  • Updates the Rust bindings documentation to describe CRT selection.
File Description
snmalloc-rs/​snmalloc-sys/​build.rs Aligns CRT selection with Rust and removes debug CRT linking.
snmalloc-rs/​README.md Documents dynamic CRT defaults and crt-static behavior.

Review effort: Balanced

@DamoyY

Copy link
Copy Markdown
Contributor Author

failed check is unrelated to my changes

@mjp41 Matthew Parkinson (mjp41) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@mjp41
Matthew Parkinson (mjp41) merged commit 48997b5 into microsoft:main Nov 2, 2026
198 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust bindings: default debug build mixes MSVCRT and MSVCRTD (LNK4098)

3 participants