diff options
| author | bors <bors@rust-lang.org> | 2019-07-13 06:49:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-07-13 06:49:02 +0000 |
| commit | 4a95e9704de0eeaecba55df102c1129e79a3a929 (patch) | |
| tree | 363bc1700a2826f38735027195160fa84ecefc2c /src/liballoc/lib.rs | |
| parent | a9c7febb879689a3d24e3ba34531026930313c4c (diff) | |
| parent | 85def307fc83f8c0d164b1506bb855dfaed5f8b5 (diff) | |
| download | rust-4a95e9704de0eeaecba55df102c1129e79a3a929.tar.gz rust-4a95e9704de0eeaecba55df102c1129e79a3a929.zip | |
Auto merge of #61953 - Centril:shared-from-iter, r=RalfJung
Add `impl<T> FromIterator<T> for Arc/Rc<[T]>` Add implementations of `FromIterator<T> for Arc/Rc<[T]>` with symmetrical logic. This also takes advantage of specialization in the case of iterators with known length (`TrustedLen`) to elide the final allocation/copying from a `Vec<T>` into `Rc<[T]>` because we can allocate the space for the `Rc<[T]>` directly when the size is known. This is the primary motivation and why this is to be preferred over `iter.collect::<Vec<_>>().into(): Rc<[T]>`. Moreover, this PR does some refactoring in some places. r? @RalfJung for the code cc @alexcrichton from T-libs
Diffstat (limited to 'src/liballoc/lib.rs')
| -rw-r--r-- | src/liballoc/lib.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 0750665c6b4..2e48825e81c 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -93,6 +93,7 @@ #![feature(ptr_offset_from)] #![feature(rustc_attrs)] #![feature(receiver_trait)] +#![feature(slice_from_raw_parts)] #![feature(specialization)] #![feature(staged_api)] #![feature(std_internals)] |
