From de21cdf792fcdb1795f42b4676bcfa68f6d3cae9 Mon Sep 17 00:00:00 2001 From: VillSnow Date: Sun, 31 Jan 2021 09:31:17 +0900 Subject: [PATCH 1/2] update documents --- library/core/src/slice/mod.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 19a3b45e568c0..6ed461aba7693 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -2082,6 +2082,12 @@ impl [T] { /// [`Result::Err`] is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. /// + /// See also [`binary_search_by`], [`binary_search_by_key`], and [`partition_point`]. + /// + /// [`binary_search_by`]: #method.binary_search_by + /// [`binary_search_by_key`]: #method.binary_search_by_key + /// [`partition_point`]: #method.partition_point + /// /// # Examples /// /// Looks up a series of four elements. The first is found, with a @@ -2129,6 +2135,12 @@ impl [T] { /// [`Result::Err`] is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. /// + /// See also [`binary_search`], [`binary_search_by_key`], and [`partition_point`]. + /// + /// [`binary_search`]: #method.binary_search + /// [`binary_search_by_key`]: #method.binary_search_by_key + /// [`partition_point`]: #method.partition_point + /// /// # Examples /// /// Looks up a series of four elements. The first is found, with a @@ -2186,7 +2198,12 @@ impl [T] { /// [`Result::Err`] is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. /// + /// See also [`binary_search`], [`binary_search_by`], and [`partition_point`]. + /// /// [`sort_by_key`]: #method.sort_by_key + /// [`binary_search`]: #method.binary_search + /// [`binary_search_by`]: #method.binary_search_by + /// [`partition_point`]: #method.partition_point /// /// # Examples /// @@ -3399,6 +3416,12 @@ impl [T] { /// If this slice is not partitioned, the returned result is unspecified and meaningless, /// as this method performs a kind of binary search. /// + /// See also [`binary_search`], [`binary_search_by`], and [`binary_search_by_key`]. + /// + /// [`binary_search`]: #method.binary_search + /// [`binary_search_by`]: #method.binary_search_by + /// [`binary_search_by_key`]: #method.binary_search_by_key + /// /// # Examples /// /// ``` From afdc8c79184dad881e618026c1ce91f2b9bae138 Mon Sep 17 00:00:00 2001 From: VillSnow Date: Thu, 14 Jan 2021 23:36:33 +0900 Subject: [PATCH 2/2] stabilize partition_point --- library/core/src/slice/mod.rs | 4 +--- library/core/tests/lib.rs | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 6ed461aba7693..c99572d98ff82 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -3425,8 +3425,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(partition_point)] - /// /// let v = [1, 2, 3, 3, 5, 6, 7]; /// let i = v.partition_point(|&x| x < 5); /// @@ -3434,7 +3432,7 @@ impl [T] { /// assert!(v[..i].iter().all(|&x| x < 5)); /// assert!(v[i..].iter().all(|&x| !(x < 5))); /// ``` - #[unstable(feature = "partition_point", reason = "new API", issue = "73831")] + #[stable(feature = "partition_point", since = "1.52.0")] pub fn partition_point

(&self, mut pred: P) -> usize where P: FnMut(&T) -> bool, diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 339691b117694..40dc6473b7d40 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -67,7 +67,6 @@ #![feature(option_result_unwrap_unchecked)] #![feature(option_unwrap_none)] #![feature(peekable_peek_mut)] -#![feature(partition_point)] #![feature(once_cell)] #![feature(unsafe_block_in_unsafe_fn)] #![feature(int_bits_const)]