diff --git a/Cargo.toml b/Cargo.toml index d33ca61..9b9ad02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,8 @@ exclude = ["/ci/", "/.github/workflows/"] [features] default = [] +checked = [] + # This tells the compiler to assume that a Nightly toolchain is being used and # that it should activate any useful Nightly things accordingly. unstable = [] @@ -23,12 +25,18 @@ unstable = [] # musl libc. musl-reference-tests = ['rand'] +rustc-dep-of-std = ["core", "compiler_builtins/rustc-dep-of-std"] + [workspace] members = [ "crates/compiler-builtins-smoke-test", "crates/libm-bench", ] +[dependencies] +core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" } +compiler_builtins = { version = "0.1", optional = true } + [dev-dependencies] no-panic = "0.1.8" diff --git a/build.rs b/build.rs index 80145a9..bbf0995 100644 --- a/build.rs +++ b/build.rs @@ -6,6 +6,9 @@ fn main() { #[cfg(feature = "musl-reference-tests")] musl_reference_tests::generate(); + println!("cargo:rustc-check-cfg=cfg(assert_no_panic)"); + println!("cargo:rustc-check-cfg=cfg(rustfmt)"); + if !cfg!(feature = "checked") { let lvl = env::var("OPT_LEVEL").unwrap(); if lvl != "0" {