Skip to content

Commit 156e12f

Browse files
authored
Merge pull request rust-lang#743 from tgross35/fix-opt-level
Account for optimization levels other than numbers
2 parents ae2ef20 + 83a61e6 commit 156e12f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

library/compiler-builtins/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn configure_libm(target: &Target) {
121121
}
122122

123123
println!("cargo:rustc-check-cfg=cfg(optimizations_enabled)");
124-
if target.opt_level >= 2 {
124+
if !matches!(target.opt_level.as_str(), "0" | "1") {
125125
println!("cargo:rustc-cfg=optimizations_enabled");
126126
}
127127

library/compiler-builtins/configure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::env;
66
#[allow(dead_code)]
77
pub struct Target {
88
pub triple: String,
9-
pub opt_level: u8,
9+
pub opt_level: String,
1010
pub cargo_features: Vec<String>,
1111
pub os: String,
1212
pub arch: String,
@@ -32,7 +32,7 @@ impl Target {
3232
Self {
3333
triple: env::var("TARGET").unwrap(),
3434
os: env::var("CARGO_CFG_TARGET_OS").unwrap(),
35-
opt_level: env::var("OPT_LEVEL").unwrap().parse().unwrap(),
35+
opt_level: env::var("OPT_LEVEL").unwrap(),
3636
cargo_features,
3737
arch: env::var("CARGO_CFG_TARGET_ARCH").unwrap(),
3838
vendor: env::var("CARGO_CFG_TARGET_VENDOR").unwrap(),

library/compiler-builtins/libm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 44770b96920557baf38990d2ee4142e166be579d
1+
Subproject commit 8e82616f154b06cf4ee9cdb82a4f56474a403d04

0 commit comments

Comments
 (0)