File tree 2 files changed +7
-0
lines changed
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 {
1589
1589
let mut base = self ;
1590
1590
let mut acc: Self = 1 ;
1591
1591
1592
+ #[ safety:: loop_invariant( true ) ]
1592
1593
loop {
1593
1594
if ( exp & 1 ) == 1 {
1594
1595
acc = try_opt!( acc. checked_mul( base) ) ;
@@ -2299,6 +2300,7 @@ macro_rules! int_impl {
2299
2300
let mut acc: Self = 1 ;
2300
2301
2301
2302
if intrinsics:: is_val_statically_known( exp) {
2303
+ #[ safety:: loop_invariant( exp>=1 ) ]
2302
2304
while exp > 1 {
2303
2305
if ( exp & 1 ) == 1 {
2304
2306
acc = acc. wrapping_mul( base) ;
@@ -2316,6 +2318,7 @@ macro_rules! int_impl {
2316
2318
// at compile time. We can't use the same code for the constant
2317
2319
// exponent case because LLVM is currently unable to unroll
2318
2320
// this loop.
2321
+ #[ safety:: loop_invariant( true ) ]
2319
2322
loop {
2320
2323
if ( exp & 1 ) == 1 {
2321
2324
acc = acc. wrapping_mul( base) ;
Original file line number Diff line number Diff line change @@ -1780,6 +1780,7 @@ macro_rules! uint_impl {
1780
1780
let mut base = self ;
1781
1781
let mut acc: Self = 1 ;
1782
1782
1783
+ #[ safety:: loop_invariant( true ) ]
1783
1784
loop {
1784
1785
if ( exp & 1 ) == 1 {
1785
1786
acc = try_opt!( acc. checked_mul( base) ) ;
@@ -2349,6 +2350,7 @@ macro_rules! uint_impl {
2349
2350
let mut acc: Self = 1 ;
2350
2351
2351
2352
if intrinsics:: is_val_statically_known( exp) {
2353
+ #[ safety:: loop_invariant( exp>=1 ) ]
2352
2354
while exp > 1 {
2353
2355
if ( exp & 1 ) == 1 {
2354
2356
acc = acc. wrapping_mul( base) ;
@@ -2366,6 +2368,7 @@ macro_rules! uint_impl {
2366
2368
// at compile time. We can't use the same code for the constant
2367
2369
// exponent case because LLVM is currently unable to unroll
2368
2370
// this loop.
2371
+ #[ safety:: loop_invariant( true ) ]
2369
2372
loop {
2370
2373
if ( exp & 1 ) == 1 {
2371
2374
acc = acc. wrapping_mul( base) ;
@@ -3044,6 +3047,7 @@ macro_rules! uint_impl {
3044
3047
// Scratch space for storing results of overflowing_mul.
3045
3048
let mut r;
3046
3049
3050
+ #[ safety:: loop_invariant( true ) ]
3047
3051
loop {
3048
3052
if ( exp & 1 ) == 1 {
3049
3053
r = acc. overflowing_mul( base) ;
You can’t perform that action at this time.
0 commit comments