Skip to content

Commit 13c5374

Browse files
committed
Simplify the configuration for no-panic
Currently, attributes for `no-panic` are gated behind both the `test` config and `assert_no_panic`, because `no-panic` is a dev dependency (so only available with test configuration). However, we only emit `assert_no_panic` when the test config is also set anyway, so there isn't any need to gate on both. Replace gates on `all(test, assert_no_panic)` with only `assert_no_panic`. This is simpler, and also has the benefit that attempting to check for panics without `--test` errors.
1 parent 767e6eb commit 13c5374

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+174
-174
lines changed

libm/src/math/acos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn r(z: f64) -> f64 {
5959
/// Computes the inverse cosine (arc cosine) of the input value.
6060
/// Arguments must be in the range -1 to 1.
6161
/// Returns values in radians, in the range of 0 to pi.
62-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
62+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
6363
pub fn acos(x: f64) -> f64 {
6464
let x1p_120f = f64::from_bits(0x3870000000000000); // 0x1p-120 === 2 ^ -120
6565
let z: f64;

libm/src/math/acosf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn r(z: f32) -> f32 {
3333
/// Computes the inverse cosine (arc cosine) of the input value.
3434
/// Arguments must be in the range -1 to 1.
3535
/// Returns values in radians, in the range of 0 to pi.
36-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
36+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
3737
pub fn acosf(x: f32) -> f32 {
3838
let x1p_120 = f32::from_bits(0x03800000); // 0x1p-120 === 2 ^ (-120)
3939

libm/src/math/acosh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa3
77
/// Calculates the inverse hyperbolic cosine of `x`.
88
/// Is defined as `log(x + sqrt(x*x-1))`.
99
/// `x` must be a number greater than or equal to 1.
10-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
10+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
1111
pub fn acosh(x: f64) -> f64 {
1212
let u = x.to_bits();
1313
let e = ((u >> 52) as usize) & 0x7ff;

libm/src/math/acoshf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const LN2: f32 = 0.693147180559945309417232121458176568;
77
/// Calculates the inverse hyperbolic cosine of `x`.
88
/// Is defined as `log(x + sqrt(x*x-1))`.
99
/// `x` must be a number greater than or equal to 1.
10-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
10+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
1111
pub fn acoshf(x: f32) -> f32 {
1212
let u = x.to_bits();
1313
let a = u & 0x7fffffff;

libm/src/math/asin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn comp_r(z: f64) -> f64 {
6666
/// Computes the inverse sine (arc sine) of the argument `x`.
6767
/// Arguments to asin must be in the range -1 to 1.
6868
/// Returns values in radians, in the range of -pi/2 to pi/2.
69-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
69+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
7070
pub fn asin(mut x: f64) -> f64 {
7171
let z: f64;
7272
let r: f64;

libm/src/math/asinf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn r(z: f32) -> f32 {
3535
/// Computes the inverse sine (arc sine) of the argument `x`.
3636
/// Arguments to asin must be in the range -1 to 1.
3737
/// Returns values in radians, in the range of -pi/2 to pi/2.
38-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
38+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
3939
pub fn asinf(mut x: f32) -> f32 {
4040
let x1p_120 = f64::from_bits(0x3870000000000000); // 0x1p-120 === 2 ^ (-120)
4141

libm/src/math/asinh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa3
77
///
88
/// Calculates the inverse hyperbolic sine of `x`.
99
/// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`.
10-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
10+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
1111
pub fn asinh(mut x: f64) -> f64 {
1212
let mut u = x.to_bits();
1313
let e = ((u >> 52) as usize) & 0x7ff;

libm/src/math/asinhf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const LN2: f32 = 0.693147180559945309417232121458176568;
77
///
88
/// Calculates the inverse hyperbolic sine of `x`.
99
/// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`.
10-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
10+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
1111
pub fn asinhf(mut x: f32) -> f32 {
1212
let u = x.to_bits();
1313
let i = u & 0x7fffffff;

libm/src/math/atan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const AT: [f64; 11] = [
6565
///
6666
/// Computes the inverse tangent (arc tangent) of the input value.
6767
/// Returns a value in radians, in the range of -pi/2 to pi/2.
68-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
68+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
6969
pub fn atan(x: f64) -> f64 {
7070
let mut x = x;
7171
let mut ix = (x.to_bits() >> 32) as u32;

libm/src/math/atan2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const PI_LO: f64 = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
4747
/// Computes the inverse tangent (arc tangent) of `y/x`.
4848
/// Produces the correct result even for angles near pi/2 or -pi/2 (that is, when `x` is near 0).
4949
/// Returns a value in radians, in the range of -pi to pi.
50-
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
50+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
5151
pub fn atan2(y: f64, x: f64) -> f64 {
5252
if x.is_nan() || y.is_nan() {
5353
return x + y;

0 commit comments

Comments
 (0)