Skip to content

Commit 8d91bbd

Browse files
committed
Auto merge of #27192 - dotdash:inline_eq_slice, r=luqmana
eq_slice_() used to be a common implementation for two function that both called it, but of those only eq_slice() is left, so we can as well directly inline the code.
2 parents cb4f102 + 000e870 commit 8d91bbd

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/libcore/str/mod.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -871,12 +871,12 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> {
871871
Section: Comparing strings
872872
*/
873873

874-
// share the implementation of the lang-item vs. non-lang-item
875-
// eq_slice.
874+
/// Bytewise slice equality
876875
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
877876
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
877+
#[lang = "str_eq"]
878878
#[inline]
879-
fn eq_slice_(a: &str, b: &str) -> bool {
879+
fn eq_slice(a: &str, b: &str) -> bool {
880880
// NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
881881
#[allow(improper_ctypes)]
882882
extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
@@ -887,15 +887,6 @@ fn eq_slice_(a: &str, b: &str) -> bool {
887887
}
888888
}
889889

890-
/// Bytewise slice equality
891-
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
892-
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
893-
#[lang = "str_eq"]
894-
#[inline]
895-
fn eq_slice(a: &str, b: &str) -> bool {
896-
eq_slice_(a, b)
897-
}
898-
899890
/*
900891
Section: Misc
901892
*/

0 commit comments

Comments
 (0)