Skip to content

Commit e6dbe3b

Browse files
committed
Factor out special casing of MSVC crt
This avoids the possibility of a duplicate or conflicting crt-static command line option sent to rustc.
1 parent 91fe8c5 commit e6dbe3b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/bootstrap/bin/rustc.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,6 @@ fn main() {
207207
}
208208
}
209209

210-
if target.contains("pc-windows-msvc") {
211-
cmd.arg("-Z").arg("unstable-options");
212-
cmd.arg("-C").arg("target-feature=+crt-static");
213-
}
214-
215210
if let Ok(s) = env::var("RUST_CRT_STATIC") {
216211
if s == "true" {
217212
cmd.arg("-Z").arg("unstable-options");

src/bootstrap/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,12 @@ impl Build {
886886

887887
/// Returns if this target should statically link the C runtime, if specified
888888
fn crt_static(&self, target: &str) -> Option<bool> {
889-
self.config.target_config.get(target)
890-
.and_then(|t| t.crt_static)
889+
if target.contains("pc-windows-msvc") {
890+
Some(true)
891+
} else {
892+
self.config.target_config.get(target)
893+
.and_then(|t| t.crt_static)
894+
}
891895
}
892896

893897
/// Returns the "musl root" for this `target`, if defined

0 commit comments

Comments
 (0)