We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce66f5d commit 02b3da1Copy full SHA for 02b3da1
src/liballoc/tests/str.rs
@@ -602,7 +602,9 @@ mod slice_index {
602
mod rangeinclusive {
603
let DATA = "hello";
604
605
- let BAD_INPUT = 1..=usize::max_value();
+ // note: using 0 specifically ensures that the result of overflowing is 0..0,
606
+ // so that `get` doesn't simply return None for the wrong reason.
607
+ let BAD_INPUT = 0..=usize::max_value();
608
const EXPECT_MSG = "maximum usize";
609
610
!!generate_tests!!
0 commit comments