rust/library/alloc/src
Guillaume Gomez 30550c048d
Rollup merge of #137268 - bjoernager:c-string-eq-c-str, r=Amanieu
Allow comparisons between `CStr`, `CString`, and `Cow<CStr>`.

Closes: #137265

This PR adds the trait implementations proposed in the [ACP](https://github.com/rust-lang/libs-team/issues/517/) under the `c_string_eq_c_str` feature gate:

```rust
// core::ffi

impl PartialEq<&Self> for CStr;

impl PartialEq<CString> for CStr;

impl PartialEq<Cow<'_, Self>> for CStr;

// alloc::ffi

impl PartialEq<CStr> for CString;

impl PartialEq<&CStr> for CString;

impl PartialEq<Cow<'_, CStr>> for CString;

// alloc::borrow

impl PartialEq<CStr> for Cow<'_, CStr>;

impl PartialEq<&CStr> for Cow<'_, CStr>;

impl PartialEq<CString> for Cow<'_, CStr>;
```

As I understand it, stable traits cannot be unstably implemented for stable types, and we would thereby be forced to skip the FCP and directly stabilise these implementations (as is done in this PR).

(`@joshtriplett` mentioned that Crater may have to be run).
2025-06-24 15:39:37 +02:00
..
boxed library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
collections vec_deque tests: remove static mut 2025-06-18 11:51:40 +00:00
ffi Rollup merge of #137268 - bjoernager:c-string-eq-c-str, r=Amanieu 2025-06-24 15:39:37 +02:00
raw_vec Simplify Vec::as_non_null implementation and make it const 2025-05-05 21:56:33 +02:00
vec update docs, test 2025-06-11 22:57:57 -04:00
alloc.rs Change __rust_no_alloc_shim_is_unstable to be a function 2025-06-16 10:54:07 -07:00
borrow.rs Fully test the alloc crate through alloctests 2025-03-07 19:11:13 +00:00
boxed.rs replace version placeholder 2025-04-09 12:29:59 +01:00
bstr.rs Fully test the alloc crate through alloctests 2025-03-07 19:11:13 +00:00
fmt.rs Fix typo in documentation 2025-04-12 22:26:38 +08:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs stabilize nonnull_provenance 2025-06-09 12:36:24 +02:00
macros.rs Streamline the format macro. 2025-04-28 06:56:13 +10:00
rc.rs Update rc.rs docs 2025-05-06 13:19:42 -07:00
slice.rs remove extraneous text 2025-06-06 06:39:51 +02:00
str.rs remove extraneous text 2025-06-06 06:39:51 +02:00
string.rs Auto merge of #142728 - kornelski:string-track, r=tgross35 2025-06-22 23:30:10 +00:00
sync.rs Auto merge of #136316 - GrigorenkoPV:generic_atomic, r=Mark-Simulacrum 2025-04-28 05:12:59 +00:00
task.rs Stabilize noop_waker 2024-12-05 14:14:17 -08:00