Skip to content

Commit a6b427e

Browse files
authored
Merge pull request rust-lang/libm#224 from Lokathor/new-CI
Refresh the CI setup
2 parents 619978e + a4e3e81 commit a6b427e

File tree

11 files changed

+37
-29
lines changed

11 files changed

+37
-29
lines changed

libm/Cargo.toml

+5-7
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ version = "0.2.0"
1111
edition = "2018"
1212

1313
[features]
14-
# only used to run our test suite
15-
default = ['stable']
16-
stable = []
14+
default = []
15+
16+
# This tells the compiler to assume that a Nightly toolchain is being used and
17+
# that it should activate any useful Nightly things accordingly.
18+
unstable = []
1719

1820
# Generate tests which are random inputs and the outputs are calculated with
1921
# musl libc.
2022
musl-reference-tests = ['rand']
2123

22-
# Used checked array indexing instead of unchecked array indexing in this
23-
# library.
24-
checked = []
25-
2624
[workspace]
2725
members = [
2826
"crates/compiler-builtins-smoke-test",

libm/azure-pipelines.yml

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ jobs:
4949
displayName: "Install rust wasm target"
5050
- script: cargo build --target wasm32-unknown-unknown
5151
displayName: "Build for wasm"
52-
- script: cargo build --target wasm32-unknown-unknown --no-default-features
53-
displayName: "Build for wasm (no default features)"
5452
variables:
5553
TOOLCHAIN: nightly
5654

libm/ci/run.sh

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
set -ex
44
TARGET=$1
55

6-
CMD="cargo test --all --no-default-features --target $TARGET"
6+
CMD="cargo test --all --target $TARGET"
77

8+
# stable by default
89
$CMD
910
$CMD --release
1011

11-
$CMD --features 'stable'
12-
$CMD --release --features 'stable'
12+
# unstable with a feature
13+
$CMD --features 'unstable'
14+
$CMD --release --features 'unstable'
1315

14-
$CMD --features 'stable checked musl-reference-tests'
15-
$CMD --release --features 'stable checked musl-reference-tests'
16+
# also run the reference tests
17+
$CMD --features 'unstable musl-reference-tests'
18+
$CMD --release --features 'unstable musl-reference-tests'

libm/crates/libm-bench/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ paste = "0.1.5"
1212

1313
[features]
1414
default = []
15-
stable = [ "libm/stable" ]
15+
unstable = [ "libm/unstable" ]

libm/src/lib.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22
#![deny(warnings)]
33
#![no_std]
44
#![cfg_attr(
5-
all(target_arch = "wasm32", not(feature = "stable")),
5+
all(target_arch = "wasm32", feature = "unstable"),
66
feature(core_intrinsics)
77
)]
8+
#![allow(clippy::unreadable_literal)]
9+
#![allow(clippy::many_single_char_names)]
10+
#![allow(clippy::needless_return)]
11+
#![allow(clippy::int_plus_one)]
12+
#![allow(clippy::deprecated_cfg_attr)]
13+
#![allow(clippy::mixed_case_hex_literals)]
14+
#![allow(clippy::float_cmp)]
15+
#![allow(clippy::eq_op)]
16+
#![allow(clippy::assign_op_pattern)]
817

918
mod math;
1019

libm/src/math/lgamma_r.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ pub fn lgamma_r(mut x: f64) -> (f64, i32) {
270270
p2 = 1.0 + y * (V1 + y * (V2 + y * (V3 + y * (V4 + y * V5))));
271271
r += -0.5 * y + p1 / p2;
272272
}
273-
#[cfg(feature = "checked")]
273+
#[cfg(debug_assertions)]
274274
_ => unreachable!(),
275-
#[cfg(not(feature = "checked"))]
275+
#[cfg(not(debug_assertions))]
276276
_ => {}
277277
}
278278
} else if ix < 0x40200000 {

libm/src/math/lgammaf_r.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ pub fn lgammaf_r(mut x: f32) -> (f32, i32) {
205205
p2 = 1.0 + y * (V1 + y * (V2 + y * (V3 + y * (V4 + y * V5))));
206206
r += -0.5 * y + p1 / p2;
207207
}
208-
#[cfg(feature = "checked")]
208+
#[cfg(debug_assertions)]
209209
_ => unreachable!(),
210-
#[cfg(not(feature = "checked"))]
210+
#[cfg(not(debug_assertions))]
211211
_ => {}
212212
}
213213
} else if ix < 0x41000000 {

libm/src/math/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ macro_rules! force_eval {
66
};
77
}
88

9-
#[cfg(not(feature = "checked"))]
9+
#[cfg(not(debug_assertions))]
1010
macro_rules! i {
1111
($array:expr, $index:expr) => {
1212
unsafe { *$array.get_unchecked($index) }
@@ -36,7 +36,7 @@ macro_rules! i {
3636
};
3737
}
3838

39-
#[cfg(feature = "checked")]
39+
#[cfg(debug_assertions)]
4040
macro_rules! i {
4141
($array:expr, $index:expr) => {
4242
*$array.get($index).unwrap()
@@ -60,7 +60,7 @@ macro_rules! i {
6060

6161
macro_rules! llvm_intrinsically_optimized {
6262
(#[cfg($($clause:tt)*)] $e:expr) => {
63-
#[cfg(all(not(feature = "stable"), $($clause)*))]
63+
#[cfg(all(feature = "unstable", $($clause)*))]
6464
{
6565
if true { // thwart the dead code lint
6666
$e

libm/src/math/rem_pio2_large.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ pub(crate) fn rem_pio2_large(x: &[f64], y: &mut [f64], e0: i32, prec: usize) ->
461461
i!(y, 2, =, -fw);
462462
}
463463
}
464-
#[cfg(feature = "checked")]
464+
#[cfg(debug_assertions)]
465465
_ => unreachable!(),
466-
#[cfg(not(feature = "checked"))]
466+
#[cfg(not(debug_assertions))]
467467
_ => {}
468468
}
469469
n & 7

libm/src/math/sincos.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ pub fn sincos(x: f64) -> (f64, f64) {
5151
1 => (c, -s),
5252
2 => (-s, -c),
5353
3 => (-c, s),
54-
#[cfg(feature = "checked")]
54+
#[cfg(debug_assertions)]
5555
_ => unreachable!(),
56-
#[cfg(not(feature = "checked"))]
56+
#[cfg(not(debug_assertions))]
5757
_ => (0.0, 1.0),
5858
}
5959
}

libm/src/math/sincosf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ pub fn sincosf(x: f32) -> (f32, f32) {
115115
1 => (c, -s),
116116
2 => (-s, -c),
117117
3 => (-c, s),
118-
#[cfg(feature = "checked")]
118+
#[cfg(debug_assertions)]
119119
_ => unreachable!(),
120-
#[cfg(not(feature = "checked"))]
120+
#[cfg(not(debug_assertions))]
121121
_ => (0.0, 1.0),
122122
}
123123
}

0 commit comments

Comments
 (0)