@@ -180,8 +180,9 @@ impl Duration {
180180 /// ```
181181 #[ stable( feature = "duration" , since = "1.3.0" ) ]
182182 #[ inline]
183- #[ rustc_const_unstable( feature = "duration_consts_2" , issue = "72440" ) ]
184183 #[ must_use]
184+ #[ rustc_const_stable( feature = "duration_consts_2" , since = "1.58.0" ) ]
185+ #[ cfg_attr( bootstrap, rustc_allow_const_fn_unstable( const_panic) ) ]
185186 pub const fn new ( secs : u64 , nanos : u32 ) -> Duration {
186187 let secs = match secs. checked_add ( ( nanos / NANOS_PER_SEC ) as u64 ) {
187188 Some ( secs) => secs,
@@ -477,7 +478,8 @@ impl Duration {
477478 #[ must_use = "this returns the result of the operation, \
478479 without modifying the original"]
479480 #[ inline]
480- #[ rustc_const_unstable( feature = "duration_consts_2" , issue = "72440" ) ]
481+ #[ rustc_const_stable( feature = "duration_consts_2" , since = "1.58.0" ) ]
482+ #[ cfg_attr( bootstrap, rustc_allow_const_fn_unstable( const_panic) ) ]
481483 pub const fn checked_add ( self , rhs : Duration ) -> Option < Duration > {
482484 if let Some ( mut secs) = self . secs . checked_add ( rhs. secs ) {
483485 let mut nanos = self . nanos + rhs. nanos ;
@@ -512,7 +514,7 @@ impl Duration {
512514 #[ must_use = "this returns the result of the operation, \
513515 without modifying the original"]
514516 #[ inline]
515- #[ rustc_const_unstable ( feature = "duration_consts_2" , issue = "72440 " ) ]
517+ #[ rustc_const_stable ( feature = "duration_consts_2" , since = "1.58.0 " ) ]
516518 pub const fn saturating_add ( self , rhs : Duration ) -> Duration {
517519 match self . checked_add ( rhs) {
518520 Some ( res) => res,
@@ -537,7 +539,8 @@ impl Duration {
537539 #[ must_use = "this returns the result of the operation, \
538540 without modifying the original"]
539541 #[ inline]
540- #[ rustc_const_unstable( feature = "duration_consts_2" , issue = "72440" ) ]
542+ #[ rustc_const_stable( feature = "duration_consts_2" , since = "1.58.0" ) ]
543+ #[ cfg_attr( bootstrap, rustc_allow_const_fn_unstable( const_panic) ) ]
541544 pub const fn checked_sub ( self , rhs : Duration ) -> Option < Duration > {
542545 if let Some ( mut secs) = self . secs . checked_sub ( rhs. secs ) {
543546 let nanos = if self . nanos >= rhs. nanos {
@@ -570,7 +573,7 @@ impl Duration {
570573 #[ must_use = "this returns the result of the operation, \
571574 without modifying the original"]
572575 #[ inline]
573- #[ rustc_const_unstable ( feature = "duration_consts_2" , issue = "72440 " ) ]
576+ #[ rustc_const_stable ( feature = "duration_consts_2" , since = "1.58.0 " ) ]
574577 pub const fn saturating_sub ( self , rhs : Duration ) -> Duration {
575578 match self . checked_sub ( rhs) {
576579 Some ( res) => res,
@@ -595,7 +598,8 @@ impl Duration {
595598 #[ must_use = "this returns the result of the operation, \
596599 without modifying the original"]
597600 #[ inline]
598- #[ rustc_const_unstable( feature = "duration_consts_2" , issue = "72440" ) ]
601+ #[ rustc_const_stable( feature = "duration_consts_2" , since = "1.58.0" ) ]
602+ #[ cfg_attr( bootstrap, rustc_allow_const_fn_unstable( const_panic) ) ]
599603 pub const fn checked_mul ( self , rhs : u32 ) -> Option < Duration > {
600604 // Multiply nanoseconds as u64, because it cannot overflow that way.
601605 let total_nanos = self . nanos as u64 * rhs as u64 ;
@@ -626,7 +630,7 @@ impl Duration {
626630 #[ must_use = "this returns the result of the operation, \
627631 without modifying the original"]
628632 #[ inline]
629- #[ rustc_const_unstable ( feature = "duration_consts_2" , issue = "72440 " ) ]
633+ #[ rustc_const_stable ( feature = "duration_consts_2" , since = "1.58.0 " ) ]
630634 pub const fn saturating_mul ( self , rhs : u32 ) -> Duration {
631635 match self . checked_mul ( rhs) {
632636 Some ( res) => res,
@@ -652,7 +656,8 @@ impl Duration {
652656 #[ must_use = "this returns the result of the operation, \
653657 without modifying the original"]
654658 #[ inline]
655- #[ rustc_const_unstable( feature = "duration_consts_2" , issue = "72440" ) ]
659+ #[ rustc_const_stable( feature = "duration_consts_2" , since = "1.58.0" ) ]
660+ #[ cfg_attr( bootstrap, rustc_allow_const_fn_unstable( const_panic) ) ]
656661 pub const fn checked_div ( self , rhs : u32 ) -> Option < Duration > {
657662 if rhs != 0 {
658663 let secs = self . secs / ( rhs as u64 ) ;
@@ -680,7 +685,7 @@ impl Duration {
680685 #[ stable( feature = "duration_float" , since = "1.38.0" ) ]
681686 #[ must_use]
682687 #[ inline]
683- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
688+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
684689 pub const fn as_secs_f64 ( & self ) -> f64 {
685690 ( self . secs as f64 ) + ( self . nanos as f64 ) / ( NANOS_PER_SEC as f64 )
686691 }
@@ -699,7 +704,7 @@ impl Duration {
699704 #[ stable( feature = "duration_float" , since = "1.38.0" ) ]
700705 #[ must_use]
701706 #[ inline]
702- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
707+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
703708 pub const fn as_secs_f32 ( & self ) -> f32 {
704709 ( self . secs as f32 ) + ( self . nanos as f32 ) / ( NANOS_PER_SEC as f32 )
705710 }
@@ -720,7 +725,7 @@ impl Duration {
720725 #[ stable( feature = "duration_float" , since = "1.38.0" ) ]
721726 #[ must_use]
722727 #[ inline]
723- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
728+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
724729 pub const fn from_secs_f64 ( secs : f64 ) -> Duration {
725730 match Duration :: try_from_secs_f64 ( secs) {
726731 Ok ( v) => v,
@@ -781,7 +786,7 @@ impl Duration {
781786 #[ stable( feature = "duration_float" , since = "1.38.0" ) ]
782787 #[ must_use]
783788 #[ inline]
784- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
789+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
785790 pub const fn from_secs_f32 ( secs : f32 ) -> Duration {
786791 match Duration :: try_from_secs_f32 ( secs) {
787792 Ok ( v) => v,
@@ -843,7 +848,7 @@ impl Duration {
843848 #[ must_use = "this returns the result of the operation, \
844849 without modifying the original"]
845850 #[ inline]
846- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
851+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
847852 pub const fn mul_f64 ( self , rhs : f64 ) -> Duration {
848853 Duration :: from_secs_f64 ( rhs * self . as_secs_f64 ( ) )
849854 }
@@ -867,7 +872,7 @@ impl Duration {
867872 #[ must_use = "this returns the result of the operation, \
868873 without modifying the original"]
869874 #[ inline]
870- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
875+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
871876 pub const fn mul_f32 ( self , rhs : f32 ) -> Duration {
872877 Duration :: from_secs_f32 ( rhs * self . as_secs_f32 ( ) )
873878 }
@@ -890,7 +895,7 @@ impl Duration {
890895 #[ must_use = "this returns the result of the operation, \
891896 without modifying the original"]
892897 #[ inline]
893- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
898+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
894899 pub const fn div_f64 ( self , rhs : f64 ) -> Duration {
895900 Duration :: from_secs_f64 ( self . as_secs_f64 ( ) / rhs)
896901 }
@@ -915,7 +920,7 @@ impl Duration {
915920 #[ must_use = "this returns the result of the operation, \
916921 without modifying the original"]
917922 #[ inline]
918- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
923+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
919924 pub const fn div_f32 ( self , rhs : f32 ) -> Duration {
920925 Duration :: from_secs_f32 ( self . as_secs_f32 ( ) / rhs)
921926 }
@@ -935,7 +940,7 @@ impl Duration {
935940 #[ must_use = "this returns the result of the operation, \
936941 without modifying the original"]
937942 #[ inline]
938- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
943+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
939944 pub const fn div_duration_f64 ( self , rhs : Duration ) -> f64 {
940945 self . as_secs_f64 ( ) / rhs. as_secs_f64 ( )
941946 }
@@ -955,7 +960,7 @@ impl Duration {
955960 #[ must_use = "this returns the result of the operation, \
956961 without modifying the original"]
957962 #[ inline]
958- #[ rustc_const_unstable( feature = "duration_consts_2 " , issue = "72440" ) ]
963+ #[ rustc_const_unstable( feature = "duration_consts_float " , issue = "72440" ) ]
959964 pub const fn div_duration_f32 ( self , rhs : Duration ) -> f32 {
960965 self . as_secs_f32 ( ) / rhs. as_secs_f32 ( )
961966 }
0 commit comments