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

Compiling libm for std #290

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ version = "0.2.8"
edition = "2018"
exclude = ["/ci/", "/.github/workflows/"]

[dependencies]
# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
core = { version = '1.0.0', optional = true, package = 'rustc-std-workspace-core' }
compiler_builtins = { version = '0.1.2', optional = true }

[features]
default = []

Expand All @@ -23,6 +29,11 @@ unstable = []
# musl libc.
musl-reference-tests = ['rand']


# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
rustc-dep-of-std = ['core', 'compiler_builtins']

[workspace]
members = [
"crates/compiler-builtins-smoke-test",
Expand Down
7 changes: 6 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ fn main() {
#[cfg(feature = "musl-reference-tests")]
musl_reference_tests::generate();

if !cfg!(feature = "checked") {
if !cfg!(debug_assertions) {
let lvl = env::var("OPT_LEVEL").unwrap();
if lvl != "0" {
println!("cargo:rustc-cfg=assert_no_panic");
}
}
// add cfg flags to suppress warnings generated from compiling `std` specifically
if cfg!(feature = "rustc-dep-of-std") {
println!("cargo:rustc-check-cfg=cfg(rustfmt)");
println!("cargo:rustc-check-cfg=cfg(assert_no_panic)");
}
}

#[cfg(feature = "musl-reference-tests")]
Expand Down
2 changes: 1 addition & 1 deletion src/math/rem_pio2_large.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub(crate) fn rem_pio2_large(x: &[f64], y: &mut [f64], e0: i32, prec: usize) ->
let x1p24 = f64::from_bits(0x4170000000000000); // 0x1p24 === 2 ^ 24
let x1p_24 = f64::from_bits(0x3e70000000000000); // 0x1p_24 === 2 ^ (-24)

#[cfg(all(target_pointer_width = "64", feature = "checked"))]
#[cfg(all(target_pointer_width = "64", debug_assertions))]
assert!(e0 <= 16360);

let nx = x.len();
Expand Down
1 change: 0 additions & 1 deletion src/math/tgamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Gamma(x)*Gamma(-x) = -pi/(x sin(pi x))

most ideas and constants are from boost and python
*/
extern crate core;
use super::{exp, floor, k_cos, k_sin, pow};

const PI: f64 = 3.141592653589793238462643383279502884;
Expand Down