File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -645,13 +645,15 @@ impl Step for Ipv6Addr {
645645 u128:: backward_checked ( start. to_bits ( ) , count) . map ( Ipv6Addr :: from_bits)
646646 }
647647
648+ #[ requires( start. to_bits( ) . checked_add( count as u128 ) . is_some( ) ) ]
648649 #[ inline]
649650 unsafe fn forward_unchecked ( start : Ipv6Addr , count : usize ) -> Ipv6Addr {
650651 // SAFETY: Since u128 and Ipv6Addr are losslessly convertible,
651652 // this is as safe as the u128 version.
652653 Ipv6Addr :: from_bits ( unsafe { u128:: forward_unchecked ( start. to_bits ( ) , count) } )
653654 }
654655
656+ #[ requires( start. to_bits( ) . checked_sub( count as u128 ) . is_some( ) ) ]
655657 #[ inline]
656658 unsafe fn backward_unchecked ( start : Ipv6Addr , count : usize ) -> Ipv6Addr {
657659 // SAFETY: Since u128 and Ipv6Addr are losslessly convertible,
You can’t perform that action at this time.
0 commit comments