about summary refs log tree commit diff
path: root/library/coretests
diff options
context:
space:
mode:
authorKarl Meakin <karl.meakin@arm.com>2025-07-25 22:17:24 +0100
committerKarl Meakin <karl.meakin@arm.com>2025-08-21 11:07:25 +0100
commit377a0c88a9bbfa8a389163b2ac3de38e64d762dc (patch)
treeb82f314b616471b15d785fe25ef60321b4f71850 /library/coretests
parent922958cffe059e9c156835df19d199ccd861c36a (diff)
downloadrust-377a0c88a9bbfa8a389163b2ac3de38e64d762dc.tar.gz
rust-377a0c88a9bbfa8a389163b2ac3de38e64d762dc.zip
Consolidate panicking functions in `slice/index.rs`
Consolidate all the panicking functions in `slice/index.rs` to use a single
`slice_index_fail` function, similar to how it is done in `str/traits.rs`.
Diffstat (limited to 'library/coretests')
-rw-r--r--library/coretests/tests/slice.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/library/coretests/tests/slice.rs b/library/coretests/tests/slice.rs
index 992f24cb18f..110c4e5f3b4 100644
--- a/library/coretests/tests/slice.rs
+++ b/library/coretests/tests/slice.rs
@@ -1492,28 +1492,28 @@ mod slice_index {
             // 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.
             bad: data[0 ..= usize::MAX];
-            message: "maximum usize";
+            message: "out of range";
         }
 
         in mod rangetoinclusive_overflow {
             data: [0, 1];
 
             bad: data[..= usize::MAX];
-            message: "maximum usize";
+            message: "out of range";
         }
 
         in mod boundpair_overflow_end {
             data: [0; 1];
 
             bad: data[(Bound::Unbounded, Bound::Included(usize::MAX))];
-            message: "maximum usize";
+            message: "out of range";
         }
 
         in mod boundpair_overflow_start {
             data: [0; 1];
 
             bad: data[(Bound::Excluded(usize::MAX), Bound::Unbounded)];
-            message: "maximum usize";
+            message: "out of range";
         }
     } // panic_cases!
 }
@@ -2008,7 +2008,7 @@ fn test_copy_within_panics_src_inverted() {
     bytes.copy_within(2..1, 0);
 }
 #[test]
-#[should_panic(expected = "attempted to index slice up to maximum usize")]
+#[should_panic(expected = "out of range")]
 fn test_copy_within_panics_src_out_of_bounds() {
     let mut bytes = *b"Hello, World!";
     // an inclusive range ending at usize::MAX would make src_end overflow