mirror of https://github.com/rust-lang/rust.git
Rollup merge of #111525 - scottmcm:slice-position-tweak, r=Mark-Simulacrum
Stop checking for the absence of something that doesn't exist A couple of codegen tests are doing ``` // CHECK-NOT: slice_index_len_fail ``` However, that function no longer exists: [the only places](https://github.com/search?q=repo%3Arust-lang%2Frust+slice_index_len_fail&type=code) it occurs in the repo are in those tests. So this PR updates the tests to check for the absense of the functions that are actually used today to panic for out-of-bounds indexing.
This commit is contained in:
commit
e52fbff5e8
|
@ -9,7 +9,9 @@
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 {
|
pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
// CHECK-NOT: slice_index_len_fail
|
// CHECK-NOT: slice_start_index_len_fail
|
||||||
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
|
// CHECK-NOT: panic_bounds_check
|
||||||
if let Ok(idx) = s.binary_search(&b'\\') {
|
if let Ok(idx) = s.binary_search(&b'\\') {
|
||||||
s[idx]
|
s[idx]
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
// CHECK-NOT: slice_index_len_fail
|
// CHECK-NOT: slice_start_index_len_fail
|
||||||
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
|
// CHECK-NOT: panic_bounds_check
|
||||||
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
||||||
&s[..idx]
|
&s[..idx]
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +24,10 @@ pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
|
pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
// CHECK-NOT: slice_index_len_fail
|
// CHECK-NOT: slice_start_index_len_fail
|
||||||
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
|
// CHECK-NOT: panic_bounds_check
|
||||||
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
||||||
&s[idx..]
|
&s[idx..]
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,7 +39,10 @@ pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn position_index_no_bounds_check(s: &[u8]) -> u8 {
|
pub fn position_index_no_bounds_check(s: &[u8]) -> u8 {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
// CHECK-NOT: slice_index_len_fail
|
// CHECK-NOT: slice_start_index_len_fail
|
||||||
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
|
// CHECK-NOT: panic_bounds_check
|
||||||
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
||||||
s[idx]
|
s[idx]
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,7 +53,10 @@ pub fn position_index_no_bounds_check(s: &[u8]) -> u8 {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
// CHECK-NOT: slice_index_len_fail
|
// CHECK-NOT: slice_start_index_len_fail
|
||||||
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
|
// CHECK-NOT: panic_bounds_check
|
||||||
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
||||||
&s[..idx]
|
&s[..idx]
|
||||||
} else {
|
} else {
|
||||||
|
@ -56,7 +68,10 @@ pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
|
pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
// CHECK-NOT: slice_index_len_fail
|
// CHECK-NOT: slice_start_index_len_fail
|
||||||
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
|
// CHECK-NOT: panic_bounds_check
|
||||||
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
||||||
&s[idx..]
|
&s[idx..]
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,7 +83,10 @@ pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 {
|
pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
// CHECK-NOT: slice_index_len_fail
|
// CHECK-NOT: slice_start_index_len_fail
|
||||||
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
|
// CHECK-NOT: panic_bounds_check
|
||||||
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
||||||
s[idx]
|
s[idx]
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue