diff options
| author | bors <bors@rust-lang.org> | 2018-12-24 07:26:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-12-24 07:26:19 +0000 |
| commit | 94bf2c15eb3d072e92855a605783a29920df9e46 (patch) | |
| tree | c54866741b6c39b4ddce1f30ae136075ec936bc5 /src/liballoc | |
| parent | e16928082aa2d66a4498132572b69156b94b25f1 (diff) | |
| parent | dff3e41914905eae0326c00de0dd9befc9d9ae83 (diff) | |
| download | rust-94bf2c15eb3d072e92855a605783a29920df9e46.tar.gz rust-94bf2c15eb3d072e92855a605783a29920df9e46.zip | |
Auto merge of #57087 - Centril:rollup, r=Centril
Rollup of 14 pull requests Successful merges: - #56188 (enum type instead of variant suggestion unification ) - #56342 (Improve docs for collecting into `Option`s) - #56916 (Fix mutable references in `static mut`) - #56917 (Simplify MIR generation for logical operations) - #56939 (Pin stabilization) - #56953 (Mark tuple structs as live if their constructors are used) - #56964 (Remove `TokenStream::JointTree`.) - #56966 (Correct strings for raw pointer deref and array access suggestions) - #57020 (Point to cause of `fn` expected return type) - #57032 (fix deprecation warnings in liballoc benches) - #57053 (Fix alignment for array indexing) - #57062 (Fix a comment) - #57067 (Stabilize min_const_unsafe_fn in 1.33) - #57078 (Ignore two tests on s390x) Failed merges: r? @ghost
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/liballoc/benches/btree/map.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/benches/lib.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/benches/slice.rs | 3 | ||||
| -rw-r--r-- | src/liballoc/benches/str.rs | 8 | ||||
| -rw-r--r-- | src/liballoc/boxed.rs | 10 | ||||
| -rw-r--r-- | src/liballoc/lib.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 8 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 8 |
9 files changed, 26 insertions, 18 deletions
diff --git a/src/liballoc/Cargo.toml b/src/liballoc/Cargo.toml index b2eb3566c04..861c7cecb88 100644 --- a/src/liballoc/Cargo.toml +++ b/src/liballoc/Cargo.toml @@ -15,6 +15,7 @@ compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] } [dev-dependencies] rand = "0.6" +rand_xorshift = "0.1" [[test]] name = "collectionstests" diff --git a/src/liballoc/benches/btree/map.rs b/src/liballoc/benches/btree/map.rs index 20b9091a07b..6e2b5e06b7a 100644 --- a/src/liballoc/benches/btree/map.rs +++ b/src/liballoc/benches/btree/map.rs @@ -12,7 +12,7 @@ use std::iter::Iterator; use std::vec::Vec; use std::collections::BTreeMap; -use rand::{Rng, thread_rng}; +use rand::{Rng, seq::SliceRandom, thread_rng}; use test::{Bencher, black_box}; macro_rules! map_insert_rand_bench { @@ -78,7 +78,7 @@ macro_rules! map_find_rand_bench { map.insert(k, k); } - rng.shuffle(&mut keys); + keys.shuffle(&mut rng); // measure let mut i = 0; diff --git a/src/liballoc/benches/lib.rs b/src/liballoc/benches/lib.rs index b4f4fd74f3a..9502a7dc3c0 100644 --- a/src/liballoc/benches/lib.rs +++ b/src/liballoc/benches/lib.rs @@ -13,6 +13,7 @@ #![feature(test)] extern crate rand; +extern crate rand_xorshift; extern crate test; mod btree; diff --git a/src/liballoc/benches/slice.rs b/src/liballoc/benches/slice.rs index 490320f57cb..fc588994063 100644 --- a/src/liballoc/benches/slice.rs +++ b/src/liballoc/benches/slice.rs @@ -12,8 +12,9 @@ use rand::{thread_rng}; use std::mem; use std::ptr; -use rand::{Rng, SeedableRng, XorShiftRng}; +use rand::{Rng, SeedableRng}; use rand::distributions::{Standard, Alphanumeric}; +use rand_xorshift::XorShiftRng; use test::{Bencher, black_box}; #[bench] diff --git a/src/liballoc/benches/str.rs b/src/liballoc/benches/str.rs index 38c94d4d8b5..c5e1576d24e 100644 --- a/src/liballoc/benches/str.rs +++ b/src/liballoc/benches/str.rs @@ -274,11 +274,11 @@ make_test!(split_a_str, s, s.split("a").count()); make_test!(trim_ascii_char, s, { s.trim_matches(|c: char| c.is_ascii()) }); -make_test!(trim_left_ascii_char, s, { - s.trim_left_matches(|c: char| c.is_ascii()) +make_test!(trim_start_ascii_char, s, { + s.trim_start_matches(|c: char| c.is_ascii()) }); -make_test!(trim_right_ascii_char, s, { - s.trim_right_matches(|c: char| c.is_ascii()) +make_test!(trim_end_ascii_char, s, { + s.trim_end_matches(|c: char| c.is_ascii()) }); make_test!(find_underscore_char, s, s.find('_')); diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index f1581310b48..7438f3e6c9d 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -111,9 +111,11 @@ impl<T> Box<T> { box x } - #[unstable(feature = "pin", issue = "49150")] + /// Constructs a new `Pin<Box<T>>`. If `T` does not implement `Unpin`, then + /// `x` will be pinned in memory and unable to be moved. + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] - pub fn pinned(x: T) -> Pin<Box<T>> { + pub fn pin(x: T) -> Pin<Box<T>> { (box x).into() } } @@ -446,7 +448,7 @@ impl<T> From<T> for Box<T> { } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl<T> From<Box<T>> for Pin<Box<T>> { fn from(boxed: Box<T>) -> Self { // It's not possible to move or replace the insides of a `Pin<Box<T>>` @@ -813,7 +815,7 @@ impl<T: ?Sized> AsMut<T> for Box<T> { * implementation of `Unpin` (where `T: Unpin`) would be valid/safe, and * could have a method to project a Pin<T> from it. */ -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl<T: ?Sized> Unpin for Box<T> { } #[unstable(feature = "generator_trait", issue = "43122")] diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index afa7a6f919d..8a66cafc001 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -102,7 +102,6 @@ #![feature(nll)] #![feature(optin_builtin_traits)] #![feature(pattern)] -#![feature(pin)] #![feature(ptr_internals)] #![feature(ptr_offset_from)] #![feature(rustc_attrs)] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 65a610b9d1e..af316b0b61b 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -325,8 +325,10 @@ impl<T> Rc<T> { } } - #[unstable(feature = "pin", issue = "49150")] - pub fn pinned(value: T) -> Pin<Rc<T>> { + /// Constructs a new `Pin<Rc<T>>`. If `T` does not implement `Unpin`, then + /// `value` will be pinned in memory and unable to be moved. + #[stable(feature = "pin", since = "1.33.0")] + pub fn pin(value: T) -> Pin<Rc<T>> { unsafe { Pin::new_unchecked(Rc::new(value)) } } @@ -1934,5 +1936,5 @@ impl<T: ?Sized> AsRef<T> for Rc<T> { } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl<T: ?Sized> Unpin for Rc<T> { } diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 948c36117a3..7b8afb1943c 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -303,8 +303,10 @@ impl<T> Arc<T> { Arc { ptr: Box::into_raw_non_null(x), phantom: PhantomData } } - #[unstable(feature = "pin", issue = "49150")] - pub fn pinned(data: T) -> Pin<Arc<T>> { + /// Constructs a new `Pin<Arc<T>>`. If `T` does not implement `Unpin`, then + /// `data` will be pinned in memory and unable to be moved. + #[stable(feature = "pin", since = "1.33.0")] + pub fn pin(data: T) -> Pin<Arc<T>> { unsafe { Pin::new_unchecked(Arc::new(data)) } } @@ -2050,5 +2052,5 @@ impl<T: ?Sized> AsRef<T> for Arc<T> { } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl<T: ?Sized> Unpin for Arc<T> { } |
