Skip to content

Conversation

npmccallum
Copy link
Contributor

This is an expansion of #143773 for the Cow From conversions.

r? @oli-obk

@rustbot
Copy link
Collaborator

rustbot commented Sep 1, 2025

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

@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 Sep 1, 2025
@@ -245,7 +245,8 @@ impl<'a> From<&'a ByteStr> for ByteString {
}

#[unstable(feature = "bstr", issue = "134915")]
impl<'a> From<ByteString> for Cow<'a, ByteStr> {
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
impl<'a> const From<ByteString> for Cow<'a, ByteStr> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have the equivalent for String? And is ByteString const constructible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oli-obk Yes, the equivalent for String is in this same patch.

ByteString is const constructible:

#[repr(transparent)]
pub struct ByteString(pub Vec<u8>);

Both Vec and String are const constructible:

https://doc.rust-lang.org/std/vec/struct.Vec.html#method.new
https://doc.rust-lang.org/std/string/struct.String.html#method.new

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh lol i stopped scrolling and didnt see the other files

@oli-obk
Copy link
Contributor

oli-obk commented Sep 1, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 1, 2025

📌 Commit 2784327 has been approved by oli-obk

It is now in the queue for this repository.

@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 Sep 1, 2025
@oli-obk
Copy link
Contributor

oli-obk commented Sep 1, 2025

@bors rollup

fmease added a commit to fmease/rust that referenced this pull request Sep 1, 2025
alloc: make Cow From impls const

This is an expansion of rust-lang#143773 for the `Cow` `From` conversions.

r? `@oli-obk`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants