Skip to content

Revert "Rollup merge of #137268 - bjoernager:c-string-eq-c-str, r=Amanieu" #143170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 0 additions & 109 deletions library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,46 +1099,6 @@ impl From<&CStr> for CString {
}
}

#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<CStr> for CString {
#[inline]
fn eq(&self, other: &CStr) -> bool {
**self == *other
}

#[inline]
fn ne(&self, other: &CStr) -> bool {
**self != *other
}
}

#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<&CStr> for CString {
#[inline]
fn eq(&self, other: &&CStr) -> bool {
**self == **other
}

#[inline]
fn ne(&self, other: &&CStr) -> bool {
**self != **other
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<Cow<'_, CStr>> for CString {
#[inline]
fn eq(&self, other: &Cow<'_, CStr>) -> bool {
**self == **other
}

#[inline]
fn ne(&self, other: &Cow<'_, CStr>) -> bool {
**self != **other
}
}

#[stable(feature = "cstring_asref", since = "1.7.0")]
impl ops::Index<ops::RangeFull> for CString {
type Output = CStr;
Expand Down Expand Up @@ -1221,75 +1181,6 @@ impl CStr {
}
}

#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<CString> for CStr {
#[inline]
fn eq(&self, other: &CString) -> bool {
*self == **other
}

#[inline]
fn ne(&self, other: &CString) -> bool {
*self != **other
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<Cow<'_, Self>> for CStr {
#[inline]
fn eq(&self, other: &Cow<'_, Self>) -> bool {
*self == **other
}

#[inline]
fn ne(&self, other: &Cow<'_, Self>) -> bool {
*self != **other
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<CStr> for Cow<'_, CStr> {
#[inline]
fn eq(&self, other: &CStr) -> bool {
**self == *other
}

#[inline]
fn ne(&self, other: &CStr) -> bool {
**self != *other
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<&CStr> for Cow<'_, CStr> {
#[inline]
fn eq(&self, other: &&CStr) -> bool {
**self == **other
}

#[inline]
fn ne(&self, other: &&CStr) -> bool {
**self != **other
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<CString> for Cow<'_, CStr> {
#[inline]
fn eq(&self, other: &CString) -> bool {
**self == **other
}

#[inline]
fn ne(&self, other: &CString) -> bool {
**self != **other
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl core::error::Error for NulError {
#[allow(deprecated)]
Expand Down
14 changes: 0 additions & 14 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,19 +660,6 @@ impl CStr {
}
}

#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
impl PartialEq<&Self> for CStr {
#[inline]
fn eq(&self, other: &&Self) -> bool {
*self == **other
}

#[inline]
fn ne(&self, other: &&Self) -> bool {
*self != **other
}
}

// `.to_bytes()` representations are compared instead of the inner `[c_char]`s,
// because `c_char` is `i8` (not `u8`) on some platforms.
// That is why this is implemented manually and not derived.
Expand All @@ -683,7 +670,6 @@ impl PartialOrd for CStr {
self.to_bytes().partial_cmp(&other.to_bytes())
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl Ord for CStr {
#[inline]
Expand Down
Loading