File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,15 @@ const DAYS_PER_WEEK: u64 = 7;
43
43
#[ rustc_layout_scalar_valid_range_end( 999_999_999 ) ]
44
44
struct Nanoseconds ( u32 ) ;
45
45
46
+ impl Nanoseconds {
47
+ // SAFETY: 0 is within the valid range
48
+ const ZERO : Self = unsafe { Nanoseconds ( 0 ) } ;
49
+ }
50
+
46
51
impl Default for Nanoseconds {
47
52
#[ inline]
48
53
fn default ( ) -> Self {
49
- // SAFETY: 0 is within the valid range
50
- unsafe { Nanoseconds ( 0 ) }
54
+ Self :: ZERO
51
55
}
52
56
}
53
57
@@ -236,7 +240,7 @@ impl Duration {
236
240
#[ inline]
237
241
#[ rustc_const_stable( feature = "duration_consts" , since = "1.32.0" ) ]
238
242
pub const fn from_secs ( secs : u64 ) -> Duration {
239
- Duration :: new ( secs, 0 )
243
+ Duration { secs, nanos : Nanoseconds :: ZERO }
240
244
}
241
245
242
246
/// Creates a new `Duration` from the specified number of milliseconds.
You can’t perform that action at this time.
0 commit comments