diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-03-16 21:56:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-16 21:56:52 -0400 |
| commit | bc6eecd0c2ed7854d52fc823be0b093f3bc76ba8 (patch) | |
| tree | ba624a9e66a33fec8bcc8bc93734d03acbdd6688 /src/libcollections | |
| parent | 6adbbfc6ba8786ea91e1051ea14d64a91839f5b5 (diff) | |
| parent | 0aeb9c12979e6da753701a798d04105b6b1a8c28 (diff) | |
Merge branch 'master' into frewsxcv-osstr
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/string.rs | 16 | ||||
| -rw-r--r-- | src/libcollections/vec.rs | 16 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 43323676ab4..13c99a2d59b 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1974,6 +1974,22 @@ impl<'a> From<&'a str> for String { } } +// note: test pulls in libstd, which causes errors here +#[cfg(not(test))] +#[stable(feature = "string_from_box", since = "1.17.0")] +impl From<Box<str>> for String { + fn from(s: Box<str>) -> String { + s.into_string() + } +} + +#[stable(feature = "box_from_str", since = "1.17.0")] +impl Into<Box<str>> for String { + fn into(self) -> Box<str> { + self.into_boxed_str() + } +} + #[stable(feature = "string_from_cow_str", since = "1.14.0")] impl<'a> From<Cow<'a, str>> for String { fn from(s: Cow<'a, str>) -> String { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index d38c9f6e1cf..e4a6af33409 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1897,6 +1897,22 @@ impl<'a, T> From<Cow<'a, [T]>> for Vec<T> where [T]: ToOwned<Owned=Vec<T>> { } } +// note: test pulls in libstd, which causes errors here +#[cfg(not(test))] +#[stable(feature = "vec_from_box", since = "1.17.0")] +impl<T> From<Box<[T]>> for Vec<T> { + fn from(s: Box<[T]>) -> Vec<T> { + s.into_vec() + } +} + +#[stable(feature = "box_from_vec", since = "1.17.0")] +impl<T> Into<Box<[T]>> for Vec<T> { + fn into(self) -> Box<[T]> { + self.into_boxed_slice() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a> From<&'a str> for Vec<u8> { fn from(s: &'a str) -> Vec<u8> { |
