Skip to content

Commit 5e58f80

Browse files
uncomment some contracts
1 parent 0f2c036 commit 5e58f80

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

library/core/src/time.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl Duration {
235235
#[must_use]
236236
#[inline]
237237
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
238-
//#[ensures(|duration| duration.is_safe())]
238+
#[ensures(|duration| duration.is_safe())]
239239
#[ensures(|duration| duration.secs == secs)]
240240
pub const fn from_secs(secs: u64) -> Duration {
241241
Duration { secs, nanos: Nanoseconds::ZERO }
@@ -511,7 +511,7 @@ impl Duration {
511511
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
512512
#[must_use]
513513
#[inline]
514-
#[ensures(|ms| *ms == self.nanos.0 / NANOS_PER_MILLI)]
514+
#[ensures(|ms| *ms == self.nanos.get_zero() / NANOS_PER_MILLI)]
515515
pub const fn subsec_millis(&self) -> u32 {
516516
self.nanos.as_inner() / NANOS_PER_MILLI
517517
}
@@ -535,7 +535,7 @@ impl Duration {
535535
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
536536
#[must_use]
537537
#[inline]
538-
//#[ensures(|ms| *ms == self.nanos.0 / NANOS_PER_MICRO)]
538+
#[ensures(|ms| *ms == self.nanos.get_zero() / NANOS_PER_MICRO)]
539539
pub const fn subsec_micros(&self) -> u32 {
540540
self.nanos.as_inner() / NANOS_PER_MICRO
541541
}
@@ -559,7 +559,7 @@ impl Duration {
559559
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
560560
#[must_use]
561561
#[inline]
562-
#[ensures(|nanos| *nanos == self.nanos.0)]
562+
#[ensures(|nanos| *nanos == self.nanos.get_zero())]
563563
pub const fn subsec_nanos(&self) -> u32 {
564564
self.nanos.as_inner()
565565
}
@@ -578,7 +578,7 @@ impl Duration {
578578
#[rustc_const_stable(feature = "duration_as_u128", since = "1.33.0")]
579579
#[must_use]
580580
#[inline]
581-
//#[ensures(|ms| *ms == self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos.0 / NANOS_PER_MILLI) as u128)]
581+
#[ensures(|ms| *ms == self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos.get_zero() / NANOS_PER_MILLI) as u128)]
582582
pub const fn as_millis(&self) -> u128 {
583583
self.secs as u128 * MILLIS_PER_SEC as u128
584584
+ (self.nanos.as_inner() / NANOS_PER_MILLI) as u128
@@ -598,7 +598,7 @@ impl Duration {
598598
#[rustc_const_stable(feature = "duration_as_u128", since = "1.33.0")]
599599
#[must_use]
600600
#[inline]
601-
#[ensures(|ms| *ms == self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos.0 / NANOS_PER_MICRO) as u128)]
601+
#[ensures(|ms| *ms == self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos.get_zero() / NANOS_PER_MICRO) as u128)]
602602
pub const fn as_micros(&self) -> u128 {
603603
self.secs as u128 * MICROS_PER_SEC as u128
604604
+ (self.nanos.as_inner() / NANOS_PER_MICRO) as u128
@@ -716,7 +716,7 @@ impl Duration {
716716
without modifying the original"]
717717
#[inline]
718718
#[rustc_const_stable(feature = "duration_consts_2", since = "1.58.0")]
719-
//#[ensures(|duration| duration.is_none() || duration.unwrap().is_safe())]
719+
#[ensures(|duration| duration.is_none() || duration.unwrap().is_safe())]
720720
pub const fn checked_sub(self, rhs: Duration) -> Option<Duration> {
721721
if let Some(mut secs) = self.secs.checked_sub(rhs.secs) {
722722
let nanos = if self.nanos.as_inner() >= rhs.nanos.as_inner() {
@@ -829,7 +829,7 @@ impl Duration {
829829
#[must_use = "this returns the result of the operation, \
830830
without modifying the original"]
831831
#[inline]
832-
//#[ensures(|duration| rhs == 0 || duration.unwrap().is_safe())]
832+
#[ensures(|duration| rhs == 0 || duration.unwrap().is_safe())]
833833
#[rustc_const_stable(feature = "duration_consts_2", since = "1.58.0")]
834834
pub const fn checked_div(self, rhs: u32) -> Option<Duration> {
835835
if rhs != 0 {

0 commit comments

Comments
 (0)