-
Notifications
You must be signed in to change notification settings - Fork 13.7k
alloc: make Cow From impls const #146067
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
base: master
Are you sure you want to change the base?
alloc: make Cow From impls const #146067
Conversation
|
@@ -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> { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
@bors r+ |
@bors rollup |
alloc: make Cow From impls const This is an expansion of rust-lang#143773 for the `Cow` `From` conversions. r? `@oli-obk`
This is an expansion of #143773 for the
Cow
From
conversions.r? @oli-obk