Skip to content

Commit dbf9798

Browse files
committed
test(kernel): replace << with checked_shl in unreachable code that would cause overflow if it was executed
Fixes build failure by `arithmetic_overflow` (deny-by-default). The Rust compiler reports an `arithmetic_overflow` lint for integer overflows detected statically. The capability of static analysis is unspecified (AFAIK), which means the exact set of code that triggers this lint may vary between compiler versions.
1 parent 41425ef commit dbf9798

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/r3_kernel/src/utils/ctz.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ mod tests {
314314
} else {
315315
let low = i & 31;
316316
let high = i >> 5;
317-
low | (high << (bits - 5))
317+
low | high.checked_shl((bits - 5) as u32).unwrap()
318318
} as usize;
319319

320320
let got = $func(in_value);

0 commit comments

Comments
 (0)