summaryrefslogtreecommitdiffstats
path: root/src/test/codegen/binary-search-index-no-bound-check.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/codegen/binary-search-index-no-bound-check.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/codegen/binary-search-index-no-bound-check.rs')
-rw-r--r--src/test/codegen/binary-search-index-no-bound-check.rs38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/test/codegen/binary-search-index-no-bound-check.rs b/src/test/codegen/binary-search-index-no-bound-check.rs
deleted file mode 100644
index c1766a4a4..000000000
--- a/src/test/codegen/binary-search-index-no-bound-check.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// compile-flags: -O
-// ignore-debug: the debug assertions get in the way
-#![crate_type = "lib"]
-
-// Make sure no bounds checks are emitted when slicing or indexing
-// with an index from `binary_search`.
-
-// CHECK-LABEL: @binary_search_index_no_bounds_check
-#[no_mangle]
-pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 {
- // CHECK-NOT: panic
- // CHECK-NOT: slice_index_len_fail
- if let Ok(idx) = s.binary_search(&b'\\') {
- s[idx]
- } else {
- 42
- }
-}
-
-// Similarly, check that `partition_point` is known to return a valid fencepost.
-
-// CHECK-LABEL: @unknown_split
-#[no_mangle]
-pub fn unknown_split(x: &[i32], i: usize) -> (&[i32], &[i32]) {
- // This just makes sure that the subsequent function is looking for the
- // absence of something that might actually be there.
-
- // CHECK: call core::panicking::panic
- x.split_at(i)
-}
-
-// CHECK-LABEL: @partition_point_split_no_bounds_check
-#[no_mangle]
-pub fn partition_point_split_no_bounds_check(x: &[i32], needle: i32) -> (&[i32], &[i32]) {
- // CHECK-NOT: call core::panicking::panic
- let i = x.partition_point(|p| p < &needle);
- x.split_at(i)
-}