diff options
| author | bors <bors@rust-lang.org> | 2018-05-17 02:05:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-05-17 02:05:39 +0000 |
| commit | b559710e58427213d6f82008206c22cf3d76b4c4 (patch) | |
| tree | d62ab7dd18ca9dd186257cbc398351281adf79ec /src/liballoc | |
| parent | 4208bd5ed8d2b62d151d759bcffec16f98248d53 (diff) | |
| parent | 3c261a4ea9d931d6af8562ab3c669a64cbf2c023 (diff) | |
| download | rust-b559710e58427213d6f82008206c22cf3d76b4c4.tar.gz rust-b559710e58427213d6f82008206c22cf3d76b4c4.zip | |
Auto merge of #50807 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests Successful merges: - #50170 (Implement From for more types on Cow) - #50638 (Don't unconditionally set CLOEXEC twice on every fd we open on Linux) - #50656 (Fix `fn main() -> impl Trait` for non-`Termination` trait) - #50669 (rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`) - #50726 (read2: Use inner function instead of closure) - #50728 (Fix rustdoc panic with `impl Trait` in type parameters) - #50736 (env: remove unwrap in examples in favor of try op) - #50740 (Remove LazyBTreeMap.) - #50752 (Add missing error codes in libsyntax-ext asm) - #50779 (Make mutable_noalias and arg_align_attributes be tracked) - #50787 (Fix run-make wasm tests) - #50788 (Fix an ICE when casting a nonexistent const) - #50789 (Ensure libraries built in stage0 have unique metadata) - #50793 (tidy: Add a check for empty UI test files) - #50797 (fix a typo in signed-integer::from_str_radix()) - #50808 (Stabilize num::NonZeroU*) - #50809 (GitHub: Stop treating Cargo.lock as a generated file.) Failed merges:
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/lib.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/string.rs | 8 | ||||
| -rw-r--r-- | src/liballoc/vec.rs | 7 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index bb78c14b905..f7dd9d4f010 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -102,7 +102,6 @@ #![feature(lang_items)] #![feature(libc)] #![feature(needs_allocator)] -#![feature(nonzero)] #![feature(optin_builtin_traits)] #![feature(pattern)] #![feature(pin)] diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index da9afdd2ca3..449e3152d8f 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -2240,6 +2240,14 @@ impl<'a> From<String> for Cow<'a, str> { } } +#[stable(feature = "cow_from_string_ref", since = "1.28.0")] +impl<'a> From<&'a String> for Cow<'a, str> { + #[inline] + fn from(s: &'a String) -> Cow<'a, str> { + Cow::Borrowed(s.as_str()) + } +} + #[stable(feature = "cow_str_from_iter", since = "1.12.0")] impl<'a> FromIterator<char> for Cow<'a, str> { fn from_iter<I: IntoIterator<Item = char>>(it: I) -> Cow<'a, str> { diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 690cbcb559b..d30f8cd0fca 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -2286,6 +2286,13 @@ impl<'a, T: Clone> From<Vec<T>> for Cow<'a, [T]> { } } +#[stable(feature = "cow_from_vec_ref", since = "1.28.0")] +impl<'a, T: Clone> From<&'a Vec<T>> for Cow<'a, [T]> { + fn from(v: &'a Vec<T>) -> Cow<'a, [T]> { + Cow::Borrowed(v.as_slice()) + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone { fn from_iter<I: IntoIterator<Item = T>>(it: I) -> Cow<'a, [T]> { |
