File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1589,6 +1589,7 @@ macro_rules! int_impl {
15891589 let mut base = self ;
15901590 let mut acc: Self = 1 ;
15911591
1592+ #[ safety:: loop_invariant( true ) ]
15921593 loop {
15931594 if ( exp & 1 ) == 1 {
15941595 acc = try_opt!( acc. checked_mul( base) ) ;
@@ -2299,6 +2300,7 @@ macro_rules! int_impl {
22992300 let mut acc: Self = 1 ;
23002301
23012302 if intrinsics:: is_val_statically_known( exp) {
2303+ #[ safety:: loop_invariant( exp>=1 ) ]
23022304 while exp > 1 {
23032305 if ( exp & 1 ) == 1 {
23042306 acc = acc. wrapping_mul( base) ;
@@ -2316,6 +2318,7 @@ macro_rules! int_impl {
23162318 // at compile time. We can't use the same code for the constant
23172319 // exponent case because LLVM is currently unable to unroll
23182320 // this loop.
2321+ #[ safety:: loop_invariant( true ) ]
23192322 loop {
23202323 if ( exp & 1 ) == 1 {
23212324 acc = acc. wrapping_mul( base) ;
Original file line number Diff line number Diff line change @@ -1780,6 +1780,7 @@ macro_rules! uint_impl {
17801780 let mut base = self ;
17811781 let mut acc: Self = 1 ;
17821782
1783+ #[ safety:: loop_invariant( true ) ]
17831784 loop {
17841785 if ( exp & 1 ) == 1 {
17851786 acc = try_opt!( acc. checked_mul( base) ) ;
@@ -2349,6 +2350,7 @@ macro_rules! uint_impl {
23492350 let mut acc: Self = 1 ;
23502351
23512352 if intrinsics:: is_val_statically_known( exp) {
2353+ #[ safety:: loop_invariant( exp>=1 ) ]
23522354 while exp > 1 {
23532355 if ( exp & 1 ) == 1 {
23542356 acc = acc. wrapping_mul( base) ;
@@ -2366,6 +2368,7 @@ macro_rules! uint_impl {
23662368 // at compile time. We can't use the same code for the constant
23672369 // exponent case because LLVM is currently unable to unroll
23682370 // this loop.
2371+ #[ safety:: loop_invariant( true ) ]
23692372 loop {
23702373 if ( exp & 1 ) == 1 {
23712374 acc = acc. wrapping_mul( base) ;
@@ -3044,6 +3047,7 @@ macro_rules! uint_impl {
30443047 // Scratch space for storing results of overflowing_mul.
30453048 let mut r;
30463049
3050+ #[ safety:: loop_invariant( true ) ]
30473051 loop {
30483052 if ( exp & 1 ) == 1 {
30493053 r = acc. overflowing_mul( base) ;
You can’t perform that action at this time.
0 commit comments