Allow comparisons between CStr, CString, and Cow<CStr>. by bjoernager · Pull Request #137268 · rust-lang/rust (original) (raw)

@bjoernager

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Feb 19, 2025

@rustbot rustbot added T-libs-api

Relevant to the library API team, which will review and decide on the PR/issue.

and removed T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Feb 19, 2025

@bjoernager bjoernager changed the titleImplement PartialEq<{&Self, CString}> for CStr and PartialEq<{CStr, &CStr}> for CString. Allow comparisons between CStr, CString, and Cow<CStr>.

Feb 19, 2025

@bjoernager

…ent 'PartialEq<{CStr, &CStr, Cow}>' for 'CString'; Implement 'PartialEq<{CStr, &CStr, CString}>' for 'Cow';

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 30, 2025

@bors

Allow comparisons between CStr, CString, and Cow<CStr>.

Closes: rust-lang#137265

This PR adds the trait implementations proposed in the ACP under the c_string_eq_c_str feature gate:

// 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).

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jun 24, 2025

bors added a commit that referenced this pull request

Jun 24, 2025

@bors

Rollup of 7 pull requests

Successful merges:

Failed merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit that referenced this pull request

Jun 24, 2025

@rust-timer

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 under the c_string_eq_c_str feature gate:

// 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).

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request

Jun 28, 2025

@workingjubilee

…tr, r=Amanieu"

This reverts commit 30550c0, reversing changes made to 36b2163.

rust-bors bot added a commit that referenced this pull request

Jun 29, 2025

@rust-bors

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

This reverts commit 30550c0, reversing changes made to 36b2163.

This is an experiment for purposes of retrying the relevant crater run.

r? @ghost

tautschnig pushed a commit to model-checking/verify-rust-std that referenced this pull request

Jul 3, 2025

@GuillaumeGomez

…anieu

Allow comparisons between CStr, CString, and Cow<CStr>.

Closes: rust-lang#137265

This PR adds the trait implementations proposed in the ACP under the c_string_eq_c_str feature gate:

// 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).

wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request

Sep 20, 2025

@he32

Pkgsrc changes:

Upstream changes relative to 1.89.0:

Version 1.90 (2025-09-18)

Language

Compiler

Platform Support

Refer to Rust's platform support page for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These previously stable APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request

Sep 24, 2025

@tmeijn

This MR contains the following updates:

Package Update Change
rust minor 1.89.0 -> 1.90.0

MR created with the help of el-capitano/tools/renovate-bot.

Proposed changes to behavior should be submitted there as MRs.


Release Notes

rust-lang/rust (rust)

v1.90.0

Compare Source

===========================

Language

Compiler

Platform Support

Refer to Rust's platform support page for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These previously stable APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this MR and you won't be reminded about this update again.



This MR has been generated by Renovate Bot.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request

Oct 18, 2025

@he32

Pkgsrc changes:

Upstream changes:

Version 1.90 (2025-09-18)

Language

Compiler

Platform Support

Refer to Rust's platform support page for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These previously stable APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

Version 1.89.0 (2025-08-07)

Language

Compiler

Platform Support

Refer to Rust's platform support page for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These previously stable APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

Internal Changes

These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request

Oct 23, 2025

@he32

Pkgsrc changes:

Upstream changes:

Version 1.90 (2025-09-18)

Language

Compiler

Platform Support

Refer to Rust's platform support page for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These previously stable APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

Version 1.89.0 (2025-08-07)

Language

Compiler

Platform Support

Refer to Rust's platform support page for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These previously stable APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

Internal Changes

These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.