about summary refs log tree commit diff
path: root/src/liballoc/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/liballoc/tests')
-rw-r--r--src/liballoc/tests/str.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/liballoc/tests/str.rs b/src/liballoc/tests/str.rs
index bfba9a6b393..696ce79f369 100644
--- a/src/liballoc/tests/str.rs
+++ b/src/liballoc/tests/str.rs
@@ -602,7 +602,9 @@ mod slice_index {
             mod rangeinclusive {
                 let DATA = "hello";
 
-                let BAD_INPUT = 1..=usize::max_value();
+                // note: using 0 specifically ensures that the result of overflowing is 0..0,
+                //       so that `get` doesn't simply return None for the wrong reason.
+                let BAD_INPUT = 0..=usize::max_value();
                 const EXPECT_MSG = "maximum usize";
 
                 !!generate_tests!!