Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit ffe79c2

Browse files
committed
Build libm-cdylib only with nightly toolchains
1 parent 4023cce commit ffe79c2

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ checked = []
2626
[workspace]
2727
members = [
2828
"crates/compiler-builtins-smoke-test",
29-
"crates/libm-cdylib",
3029
"crates/libm-bench",
30+
"crates/libm-cdylib",
3131
]
3232

3333
[dev-dependencies]

ci/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fi
2424
$CMD --features "stable checked"
2525
$CMD --release --features "stable checked ${TEST_MUSL}"
2626

27-
if rustc --version | grep -E "nightly" ; then
27+
if rustc --version | grep "nightly" ; then
2828
if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] || [ "${TARGET}" = "x86_64-apple-darwin" ]; then
2929
(
3030
cd crates/libm-cdylib

crates/libm-cdylib/build.rs

+9
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@ fn main() {
55
if profile == "release" {
66
println!("cargo:rustc-cfg=release_profile");
77
}
8+
let nightly = {
9+
let mut cmd = std::process::Command::new("rustc");
10+
cmd.arg("--version");
11+
let output = String::from_utf8(cmd.output().unwrap().stdout).unwrap();
12+
output.contains("nightly")
13+
};
14+
if nightly {
15+
println!("cargo:rustc-cfg=unstable_rust");
16+
}
817
}

crates/libm-cdylib/src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#![cfg(
2+
// The tests are only enabled on x86 32/64-bit linux/macos:
3+
all(unstable_rust,
4+
any(target_os = "linux", target_os = "macos"),
5+
any(target_arch = "x86", target_arch = "x86_64")
6+
)
7+
)]
18
#![allow(dead_code)]
29
#![cfg_attr(not(test), feature(core_intrinsics, lang_items))]
310
#![cfg_attr(not(test), no_std)]

0 commit comments

Comments
 (0)