Move the existing "unstable" feature to "unstable-intrinsics"
Currently there is a single feature called "unstable" that is used to control whether intrinsics may be called. In anticipation of adding other unstable features that we will want to control separately, create a new feature called "unstable-intrinsics" that is enabled by "unstable". Then move everything gated by "unstable" to "unstable-intrinsics".
This commit is contained in:
parent
7137c7acfc
commit
66f8906862
5 changed files with 16 additions and 9 deletions
|
|
@ -18,7 +18,10 @@ default = []
|
|||
|
||||
# This tells the compiler to assume that a Nightly toolchain is being used and
|
||||
# that it should activate any useful Nightly things accordingly.
|
||||
unstable = []
|
||||
unstable = ["unstable-intrinsics"]
|
||||
|
||||
# Enable calls to functions in `core::intrinsics`
|
||||
unstable-intrinsics = []
|
||||
|
||||
# Used to prevent using any intrinsics or arch-specific code.
|
||||
force-soft-floats = []
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ fi
|
|||
if [ "${BUILD_ONLY:-}" = "1" ]; then
|
||||
cmd="cargo build --target $target --package libm"
|
||||
$cmd
|
||||
$cmd --features 'unstable'
|
||||
$cmd --features "unstable-intrinsics"
|
||||
|
||||
echo "can't run tests on $target"
|
||||
else
|
||||
|
|
@ -60,6 +60,6 @@ else
|
|||
$cmd --release
|
||||
|
||||
# unstable with a feature
|
||||
$cmd --features 'unstable'
|
||||
$cmd --release --features 'unstable'
|
||||
$cmd --features "unstable-intrinsics"
|
||||
$cmd --release --features "unstable-intrinsics"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ test = false
|
|||
bench = false
|
||||
|
||||
[features]
|
||||
# Duplicated from libm's Cargo.toml
|
||||
unstable = []
|
||||
unstable-intrinsics = []
|
||||
checked = []
|
||||
force-soft-floats = []
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//! libm in pure Rust
|
||||
#![no_std]
|
||||
#![cfg_attr(feature = "unstable", allow(internal_features))]
|
||||
#![cfg_attr(feature = "unstable", feature(core_intrinsics))]
|
||||
#![cfg_attr(feature = "unstable-intrinsics", allow(internal_features))]
|
||||
#![cfg_attr(feature = "unstable-intrinsics", feature(core_intrinsics))]
|
||||
#![allow(clippy::assign_op_pattern)]
|
||||
#![allow(clippy::deprecated_cfg_attr)]
|
||||
#![allow(clippy::eq_op)]
|
||||
|
|
|
|||
|
|
@ -60,14 +60,14 @@ macro_rules! i {
|
|||
// the time of this writing this is only used in a few places, and once
|
||||
// rust-lang/rust#72751 is fixed then this macro will no longer be necessary and
|
||||
// the native `/` operator can be used and panics won't be codegen'd.
|
||||
#[cfg(any(debug_assertions, not(feature = "unstable")))]
|
||||
#[cfg(any(debug_assertions, not(feature = "unstable-intrinsics")))]
|
||||
macro_rules! div {
|
||||
($a:expr, $b:expr) => {
|
||||
$a / $b
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(all(not(debug_assertions), feature = "unstable"))]
|
||||
#[cfg(all(not(debug_assertions), feature = "unstable-intrinsics"))]
|
||||
macro_rules! div {
|
||||
($a:expr, $b:expr) => {
|
||||
unsafe { core::intrinsics::unchecked_div($a, $b) }
|
||||
|
|
@ -76,7 +76,9 @@ macro_rules! div {
|
|||
|
||||
macro_rules! llvm_intrinsically_optimized {
|
||||
(#[cfg($($clause:tt)*)] $e:expr) => {
|
||||
#[cfg(all(feature = "unstable", not(feature = "force-soft-floats"), $($clause)*))]
|
||||
#[cfg(all(
|
||||
feature = "unstable-intrinsics", not(feature = "force-soft-floats"), $($clause)*
|
||||
))]
|
||||
{
|
||||
if true { // thwart the dead code lint
|
||||
$e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue