Skip to content
Open
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
3 changes: 2 additions & 1 deletion library/alloc/src/bstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ impl Clone for Box<ByteStr> {
}

#[unstable(feature = "bstr", issue = "134915")]
impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl<'a> const From<&'a ByteStr> for Cow<'a, ByteStr> {
#[inline]
fn from(s: &'a ByteStr) -> Self {
Cow::Borrowed(s)
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,8 @@ impl<'a> From<CString> for Cow<'a, CStr> {
}

#[stable(feature = "cow_from_cstr", since = "1.28.0")]
impl<'a> From<&'a CStr> for Cow<'a, CStr> {
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl<'a> const From<&'a CStr> for Cow<'a, CStr> {
/// Converts a [`CStr`] into a borrowed [`Cow`] without copying or allocating.
#[inline]
fn from(s: &'a CStr) -> Cow<'a, CStr> {
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3096,7 +3096,8 @@ impl<'a> From<Cow<'a, str>> for String {

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> From<&'a str> for Cow<'a, str> {
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl<'a> const From<&'a str> for Cow<'a, str> {
/// Converts a string slice into a [`Borrowed`] variant.
/// No heap allocation is performed, and the string
/// is not copied.
Expand Down
6 changes: 4 additions & 2 deletions library/alloc/src/vec/cow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use super::Vec;
use crate::borrow::Cow;

#[stable(feature = "cow_from_vec", since = "1.8.0")]
impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> {
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl<'a, T: Clone> const From<&'a [T]> for Cow<'a, [T]> {
/// Creates a [`Borrowed`] variant of [`Cow`]
/// from a slice.
///
Expand All @@ -15,7 +16,8 @@ impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> {
}

#[stable(feature = "cow_from_array_ref", since = "1.77.0")]
impl<'a, T: Clone, const N: usize> From<&'a [T; N]> for Cow<'a, [T]> {
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl<'a, T: Clone, const N: usize> const From<&'a [T; N]> for Cow<'a, [T]> {
/// Creates a [`Borrowed`] variant of [`Cow`]
/// from a reference to an array.
///
Expand Down
Loading