Skip to content

Commit 7816935

Browse files
committed
move f16/f128 const fn under f16/f128 feature gate
1 parent 267cf8d commit 7816935

File tree

7 files changed

+22
-26
lines changed

7 files changed

+22
-26
lines changed

library/core/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@
164164
#![feature(coverage_attribute)]
165165
#![feature(do_not_recommend)]
166166
#![feature(duration_consts_float)]
167-
#![feature(f128_const)]
168-
#![feature(f16_const)]
169167
#![feature(internal_impls_macro)]
170168
#![feature(ip)]
171169
#![feature(is_ascii_octdigit)]

library/core/src/num/f128.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ impl f128 {
910910
/// ```
911911
#[inline]
912912
#[unstable(feature = "f128", issue = "116909")]
913-
#[rustc_const_unstable(feature = "f128_const", issue = "116909")]
913+
#[rustc_const_unstable(feature = "f128", issue = "116909")]
914914
#[must_use = "this returns the result of the operation, without modifying the original"]
915915
pub const fn to_bits(self) -> u128 {
916916
// SAFETY: `u128` is a plain old datatype so we can always transmute to it.
@@ -959,7 +959,7 @@ impl f128 {
959959
#[inline]
960960
#[must_use]
961961
#[unstable(feature = "f128", issue = "116909")]
962-
#[rustc_const_unstable(feature = "f128_const", issue = "116909")]
962+
#[rustc_const_unstable(feature = "f128", issue = "116909")]
963963
pub const fn from_bits(v: u128) -> Self {
964964
// It turns out the safety issues with sNaN were overblown! Hooray!
965965
// SAFETY: `u128` is a plain old datatype so we can always transmute from it.
@@ -986,7 +986,7 @@ impl f128 {
986986
/// ```
987987
#[inline]
988988
#[unstable(feature = "f128", issue = "116909")]
989-
#[rustc_const_unstable(feature = "f128_const", issue = "116909")]
989+
#[rustc_const_unstable(feature = "f128", issue = "116909")]
990990
#[must_use = "this returns the result of the operation, without modifying the original"]
991991
pub const fn to_be_bytes(self) -> [u8; 16] {
992992
self.to_bits().to_be_bytes()
@@ -1012,7 +1012,7 @@ impl f128 {
10121012
/// ```
10131013
#[inline]
10141014
#[unstable(feature = "f128", issue = "116909")]
1015-
#[rustc_const_unstable(feature = "f128_const", issue = "116909")]
1015+
#[rustc_const_unstable(feature = "f128", issue = "116909")]
10161016
#[must_use = "this returns the result of the operation, without modifying the original"]
10171017
pub const fn to_le_bytes(self) -> [u8; 16] {
10181018
self.to_bits().to_le_bytes()
@@ -1049,7 +1049,7 @@ impl f128 {
10491049
/// ```
10501050
#[inline]
10511051
#[unstable(feature = "f128", issue = "116909")]
1052-
#[rustc_const_unstable(feature = "f128_const", issue = "116909")]
1052+
#[rustc_const_unstable(feature = "f128", issue = "116909")]
10531053
#[must_use = "this returns the result of the operation, without modifying the original"]
10541054
pub const fn to_ne_bytes(self) -> [u8; 16] {
10551055
self.to_bits().to_ne_bytes()
@@ -1077,7 +1077,7 @@ impl f128 {
10771077
#[inline]
10781078
#[must_use]
10791079
#[unstable(feature = "f128", issue = "116909")]
1080-
#[rustc_const_unstable(feature = "f128_const", issue = "116909")]
1080+
#[rustc_const_unstable(feature = "f128", issue = "116909")]
10811081
pub const fn from_be_bytes(bytes: [u8; 16]) -> Self {
10821082
Self::from_bits(u128::from_be_bytes(bytes))
10831083
}
@@ -1104,7 +1104,7 @@ impl f128 {
11041104
#[inline]
11051105
#[must_use]
11061106
#[unstable(feature = "f128", issue = "116909")]
1107-
#[rustc_const_unstable(feature = "f128_const", issue = "116909")]
1107+
#[rustc_const_unstable(feature = "f128", issue = "116909")]
11081108
pub const fn from_le_bytes(bytes: [u8; 16]) -> Self {
11091109
Self::from_bits(u128::from_le_bytes(bytes))
11101110
}
@@ -1141,7 +1141,7 @@ impl f128 {
11411141
#[inline]
11421142
#[must_use]
11431143
#[unstable(feature = "f128", issue = "116909")]
1144-
#[rustc_const_unstable(feature = "f128_const", issue = "116909")]
1144+
#[rustc_const_unstable(feature = "f128", issue = "116909")]
11451145
pub const fn from_ne_bytes(bytes: [u8; 16]) -> Self {
11461146
Self::from_bits(u128::from_ne_bytes(bytes))
11471147
}

library/core/src/num/f16.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ impl f16 {
896896
/// ```
897897
#[inline]
898898
#[unstable(feature = "f16", issue = "116909")]
899-
#[rustc_const_unstable(feature = "f16_const", issue = "116909")]
899+
#[rustc_const_unstable(feature = "f16", issue = "116909")]
900900
#[must_use = "this returns the result of the operation, without modifying the original"]
901901
pub const fn to_bits(self) -> u16 {
902902
// SAFETY: `u16` is a plain old datatype so we can always transmute to it.
@@ -944,7 +944,7 @@ impl f16 {
944944
#[inline]
945945
#[must_use]
946946
#[unstable(feature = "f16", issue = "116909")]
947-
#[rustc_const_unstable(feature = "f16_const", issue = "116909")]
947+
#[rustc_const_unstable(feature = "f16", issue = "116909")]
948948
pub const fn from_bits(v: u16) -> Self {
949949
// It turns out the safety issues with sNaN were overblown! Hooray!
950950
// SAFETY: `u16` is a plain old datatype so we can always transmute from it.
@@ -970,7 +970,7 @@ impl f16 {
970970
/// ```
971971
#[inline]
972972
#[unstable(feature = "f16", issue = "116909")]
973-
#[rustc_const_unstable(feature = "f16_const", issue = "116909")]
973+
#[rustc_const_unstable(feature = "f16", issue = "116909")]
974974
#[must_use = "this returns the result of the operation, without modifying the original"]
975975
pub const fn to_be_bytes(self) -> [u8; 2] {
976976
self.to_bits().to_be_bytes()
@@ -995,7 +995,7 @@ impl f16 {
995995
/// ```
996996
#[inline]
997997
#[unstable(feature = "f16", issue = "116909")]
998-
#[rustc_const_unstable(feature = "f16_const", issue = "116909")]
998+
#[rustc_const_unstable(feature = "f16", issue = "116909")]
999999
#[must_use = "this returns the result of the operation, without modifying the original"]
10001000
pub const fn to_le_bytes(self) -> [u8; 2] {
10011001
self.to_bits().to_le_bytes()
@@ -1033,7 +1033,7 @@ impl f16 {
10331033
/// ```
10341034
#[inline]
10351035
#[unstable(feature = "f16", issue = "116909")]
1036-
#[rustc_const_unstable(feature = "f16_const", issue = "116909")]
1036+
#[rustc_const_unstable(feature = "f16", issue = "116909")]
10371037
#[must_use = "this returns the result of the operation, without modifying the original"]
10381038
pub const fn to_ne_bytes(self) -> [u8; 2] {
10391039
self.to_bits().to_ne_bytes()
@@ -1057,7 +1057,7 @@ impl f16 {
10571057
#[inline]
10581058
#[must_use]
10591059
#[unstable(feature = "f16", issue = "116909")]
1060-
#[rustc_const_unstable(feature = "f16_const", issue = "116909")]
1060+
#[rustc_const_unstable(feature = "f16", issue = "116909")]
10611061
pub const fn from_be_bytes(bytes: [u8; 2]) -> Self {
10621062
Self::from_bits(u16::from_be_bytes(bytes))
10631063
}
@@ -1080,7 +1080,7 @@ impl f16 {
10801080
#[inline]
10811081
#[must_use]
10821082
#[unstable(feature = "f16", issue = "116909")]
1083-
#[rustc_const_unstable(feature = "f16_const", issue = "116909")]
1083+
#[rustc_const_unstable(feature = "f16", issue = "116909")]
10841084
pub const fn from_le_bytes(bytes: [u8; 2]) -> Self {
10851085
Self::from_bits(u16::from_le_bytes(bytes))
10861086
}
@@ -1114,7 +1114,7 @@ impl f16 {
11141114
#[inline]
11151115
#[must_use]
11161116
#[unstable(feature = "f16", issue = "116909")]
1117-
#[rustc_const_unstable(feature = "f16_const", issue = "116909")]
1117+
#[rustc_const_unstable(feature = "f16", issue = "116909")]
11181118
pub const fn from_ne_bytes(bytes: [u8; 2]) -> Self {
11191119
Self::from_bits(u16::from_ne_bytes(bytes))
11201120
}

src/tools/clippy/tests/ui/transmute_float_to_int.fixed

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![warn(clippy::transmute_float_to_int)]
22
#![allow(clippy::missing_transmute_annotations)]
3-
#![feature(f128, f128_const)]
4-
#![feature(f16, f16_const)]
3+
#![feature(f128)]
4+
#![feature(f16)]
55

66
fn float_to_int() {
77
let _: u32 = unsafe { 1f32.to_bits() };

src/tools/clippy/tests/ui/transmute_float_to_int.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![warn(clippy::transmute_float_to_int)]
22
#![allow(clippy::missing_transmute_annotations)]
3-
#![feature(f128, f128_const)]
4-
#![feature(f16, f16_const)]
3+
#![feature(f128)]
4+
#![feature(f16)]
55

66
fn float_to_int() {
77
let _: u32 = unsafe { std::mem::transmute(1f32) };

tests/ui/float/classify-runtime-const.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
// This tests the float classification functions, for regular runtime code and for const evaluation.
88

9-
#![feature(f16_const)]
10-
#![feature(f128_const)]
9+
#![feature(f16)]
10+
#![feature(f128)]
1111
#![feature(const_float_classify)]
1212

1313
use std::num::FpCategory::*;

tests/ui/float/conv-bits-runtime-const.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#![feature(const_float_classify)]
77
#![feature(f16)]
88
#![feature(f128)]
9-
#![feature(f16_const)]
10-
#![feature(f128_const)]
119
#![allow(unused_macro_rules)]
1210

1311
use std::hint::black_box;

0 commit comments

Comments
 (0)