File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 3737#![ feature( duration_constants) ]
3838#![ feature( duration_constructors) ]
3939#![ feature( duration_constructors_lite) ]
40+ #![ feature( duration_from_nanos_u128) ]
4041#![ feature( error_generic_member_access) ]
4142#![ feature( exact_div) ]
4243#![ feature( exact_size_is_empty) ]
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ fn from_weeks_overflow() {
4848#[ test]
4949#[ should_panic]
5050fn from_nanos_u128_overflow ( ) {
51- let overflow = ( u64:: MAX * NANOS_PER_SEC ) + ( NANOS_PER_SEC - 1 ) + 1 ;
51+ let overflow = ( u64:: MAX as u128 * 1_000_000_000 ) + ( 1_000_000_000 - 1 ) + 1 ;
5252 let _ = Duration :: from_nanos_u128 ( overflow) ;
5353}
5454
@@ -535,6 +535,9 @@ fn duration_const() {
535535 const FROM_NANOS : Duration = Duration :: from_nanos ( 1_000_000_000 ) ;
536536 assert_eq ! ( FROM_NANOS , Duration :: SECOND ) ;
537537
538+ const FROM_NANOS_U128 : Duration = Duration :: from_nanos_u128 ( NANOS ) ;
539+ assert_eq ! ( FROM_NANOS_U128 , Duration :: SECOND ) ;
540+
538541 const MAX : Duration = Duration :: new ( u64:: MAX , 999_999_999 ) ;
539542
540543 const CHECKED_ADD : Option < Duration > = MAX . checked_add ( Duration :: SECOND ) ;
You can’t perform that action at this time.
0 commit comments