File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -817,6 +817,10 @@ macro_rules! nonzero_integer {
817817 #[ must_use = "this returns the result of the operation, \
818818 without modifying the original"]
819819 #[ inline( always) ]
820+ #[ rustc_allow_const_fn_unstable( contracts) ]
821+ #[ core:: contracts:: requires( let old : NonZero < $Int> = self ; true ) ]
822+ #[ core:: contracts:: ensures(
823+ move |result: & NonZero < $Int> | result. rotate_right( n) . get( ) == old. get( ) ) ]
820824 pub const fn rotate_left( self , n: u32) -> Self {
821825 let result = self . get( ) . rotate_left( n) ;
822826 // SAFETY: Rotating bits preserves the property int > 0.
@@ -848,6 +852,10 @@ macro_rules! nonzero_integer {
848852 #[ must_use = "this returns the result of the operation, \
849853 without modifying the original"]
850854 #[ inline( always) ]
855+ #[ rustc_allow_const_fn_unstable( contracts) ]
856+ #[ core:: contracts:: requires( let old : NonZero < $Int> = self ; true ) ]
857+ #[ core:: contracts:: ensures(
858+ move |result: & NonZero < $Int> | result. rotate_left( n) . get( ) == old. get( ) ) ]
851859 pub const fn rotate_right( self , n: u32) -> Self {
852860 let result = self . get( ) . rotate_right( n) ;
853861 // SAFETY: Rotating bits preserves the property int > 0.
You can’t perform that action at this time.
0 commit comments