Skip to content

Commit 7b72c28

Browse files
committed
Stabilize float_to_from_bytes feature
1 parent 92df638 commit 7b72c28

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

src/libcore/num/f32.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,10 @@ impl f32 {
466466
/// # Examples
467467
///
468468
/// ```
469-
/// #![feature(float_to_from_bytes)]
470469
/// let bytes = 12.5f32.to_be_bytes();
471470
/// assert_eq!(bytes, [0x41, 0x48, 0x00, 0x00]);
472471
/// ```
473-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
472+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
474473
#[inline]
475474
pub fn to_be_bytes(self) -> [u8; 4] {
476475
self.to_bits().to_be_bytes()
@@ -482,11 +481,10 @@ impl f32 {
482481
/// # Examples
483482
///
484483
/// ```
485-
/// #![feature(float_to_from_bytes)]
486484
/// let bytes = 12.5f32.to_le_bytes();
487485
/// assert_eq!(bytes, [0x00, 0x00, 0x48, 0x41]);
488486
/// ```
489-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
487+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
490488
#[inline]
491489
pub fn to_le_bytes(self) -> [u8; 4] {
492490
self.to_bits().to_le_bytes()
@@ -504,7 +502,6 @@ impl f32 {
504502
/// # Examples
505503
///
506504
/// ```
507-
/// #![feature(float_to_from_bytes)]
508505
/// let bytes = 12.5f32.to_ne_bytes();
509506
/// assert_eq!(
510507
/// bytes,
@@ -515,7 +512,7 @@ impl f32 {
515512
/// }
516513
/// );
517514
/// ```
518-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
515+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
519516
#[inline]
520517
pub fn to_ne_bytes(self) -> [u8; 4] {
521518
self.to_bits().to_ne_bytes()
@@ -526,11 +523,10 @@ impl f32 {
526523
/// # Examples
527524
///
528525
/// ```
529-
/// #![feature(float_to_from_bytes)]
530526
/// let value = f32::from_be_bytes([0x41, 0x48, 0x00, 0x00]);
531527
/// assert_eq!(value, 12.5);
532528
/// ```
533-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
529+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
534530
#[inline]
535531
pub fn from_be_bytes(bytes: [u8; 4]) -> Self {
536532
Self::from_bits(u32::from_be_bytes(bytes))
@@ -541,11 +537,10 @@ impl f32 {
541537
/// # Examples
542538
///
543539
/// ```
544-
/// #![feature(float_to_from_bytes)]
545540
/// let value = f32::from_le_bytes([0x00, 0x00, 0x48, 0x41]);
546541
/// assert_eq!(value, 12.5);
547542
/// ```
548-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
543+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
549544
#[inline]
550545
pub fn from_le_bytes(bytes: [u8; 4]) -> Self {
551546
Self::from_bits(u32::from_le_bytes(bytes))
@@ -563,15 +558,14 @@ impl f32 {
563558
/// # Examples
564559
///
565560
/// ```
566-
/// #![feature(float_to_from_bytes)]
567561
/// let value = f32::from_ne_bytes(if cfg!(target_endian = "big") {
568562
/// [0x41, 0x48, 0x00, 0x00]
569563
/// } else {
570564
/// [0x00, 0x00, 0x48, 0x41]
571565
/// });
572566
/// assert_eq!(value, 12.5);
573567
/// ```
574-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
568+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
575569
#[inline]
576570
pub fn from_ne_bytes(bytes: [u8; 4]) -> Self {
577571
Self::from_bits(u32::from_ne_bytes(bytes))

src/libcore/num/f64.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,10 @@ impl f64 {
479479
/// # Examples
480480
///
481481
/// ```
482-
/// #![feature(float_to_from_bytes)]
483482
/// let bytes = 12.5f64.to_be_bytes();
484483
/// assert_eq!(bytes, [0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
485484
/// ```
486-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
485+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
487486
#[inline]
488487
pub fn to_be_bytes(self) -> [u8; 8] {
489488
self.to_bits().to_be_bytes()
@@ -495,11 +494,10 @@ impl f64 {
495494
/// # Examples
496495
///
497496
/// ```
498-
/// #![feature(float_to_from_bytes)]
499497
/// let bytes = 12.5f64.to_le_bytes();
500498
/// assert_eq!(bytes, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]);
501499
/// ```
502-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
500+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
503501
#[inline]
504502
pub fn to_le_bytes(self) -> [u8; 8] {
505503
self.to_bits().to_le_bytes()
@@ -517,7 +515,6 @@ impl f64 {
517515
/// # Examples
518516
///
519517
/// ```
520-
/// #![feature(float_to_from_bytes)]
521518
/// let bytes = 12.5f64.to_ne_bytes();
522519
/// assert_eq!(
523520
/// bytes,
@@ -528,7 +525,7 @@ impl f64 {
528525
/// }
529526
/// );
530527
/// ```
531-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
528+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
532529
#[inline]
533530
pub fn to_ne_bytes(self) -> [u8; 8] {
534531
self.to_bits().to_ne_bytes()
@@ -539,11 +536,10 @@ impl f64 {
539536
/// # Examples
540537
///
541538
/// ```
542-
/// #![feature(float_to_from_bytes)]
543539
/// let value = f64::from_be_bytes([0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
544540
/// assert_eq!(value, 12.5);
545541
/// ```
546-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
542+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
547543
#[inline]
548544
pub fn from_be_bytes(bytes: [u8; 8]) -> Self {
549545
Self::from_bits(u64::from_be_bytes(bytes))
@@ -554,11 +550,10 @@ impl f64 {
554550
/// # Examples
555551
///
556552
/// ```
557-
/// #![feature(float_to_from_bytes)]
558553
/// let value = f64::from_le_bytes([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]);
559554
/// assert_eq!(value, 12.5);
560555
/// ```
561-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
556+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
562557
#[inline]
563558
pub fn from_le_bytes(bytes: [u8; 8]) -> Self {
564559
Self::from_bits(u64::from_le_bytes(bytes))
@@ -576,15 +571,14 @@ impl f64 {
576571
/// # Examples
577572
///
578573
/// ```
579-
/// #![feature(float_to_from_bytes)]
580574
/// let value = f64::from_ne_bytes(if cfg!(target_endian = "big") {
581575
/// [0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
582576
/// } else {
583577
/// [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]
584578
/// });
585579
/// assert_eq!(value, 12.5);
586580
/// ```
587-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
581+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
588582
#[inline]
589583
pub fn from_ne_bytes(bytes: [u8; 8]) -> Self {
590584
Self::from_bits(u64::from_ne_bytes(bytes))

0 commit comments

Comments
 (0)