Skip to content

Commit 8280abc

Browse files
authored
Rollup merge of rust-lang#81012 - VillSnow:stabilize_partition_point, r=matklad
Stabilize the partition_point feature Stabilize the partition_point feature. Tracking Issue: rust-lang#73831 First PR: rust-lang#73577
2 parents ab3f4f0 + afdc8c7 commit 8280abc

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

library/core/src/slice/mod.rs

+24-3
Original file line numberDiff line numberDiff line change
@@ -2082,6 +2082,12 @@ impl<T> [T] {
20822082
/// [`Result::Err`] is returned, containing the index where a matching
20832083
/// element could be inserted while maintaining sorted order.
20842084
///
2085+
/// See also [`binary_search_by`], [`binary_search_by_key`], and [`partition_point`].
2086+
///
2087+
/// [`binary_search_by`]: #method.binary_search_by
2088+
/// [`binary_search_by_key`]: #method.binary_search_by_key
2089+
/// [`partition_point`]: #method.partition_point
2090+
///
20852091
/// # Examples
20862092
///
20872093
/// Looks up a series of four elements. The first is found, with a
@@ -2129,6 +2135,12 @@ impl<T> [T] {
21292135
/// [`Result::Err`] is returned, containing the index where a matching
21302136
/// element could be inserted while maintaining sorted order.
21312137
///
2138+
/// See also [`binary_search`], [`binary_search_by_key`], and [`partition_point`].
2139+
///
2140+
/// [`binary_search`]: #method.binary_search
2141+
/// [`binary_search_by_key`]: #method.binary_search_by_key
2142+
/// [`partition_point`]: #method.partition_point
2143+
///
21322144
/// # Examples
21332145
///
21342146
/// Looks up a series of four elements. The first is found, with a
@@ -2186,7 +2198,12 @@ impl<T> [T] {
21862198
/// [`Result::Err`] is returned, containing the index where a matching
21872199
/// element could be inserted while maintaining sorted order.
21882200
///
2201+
/// See also [`binary_search`], [`binary_search_by`], and [`partition_point`].
2202+
///
21892203
/// [`sort_by_key`]: #method.sort_by_key
2204+
/// [`binary_search`]: #method.binary_search
2205+
/// [`binary_search_by`]: #method.binary_search_by
2206+
/// [`partition_point`]: #method.partition_point
21902207
///
21912208
/// # Examples
21922209
///
@@ -3399,19 +3416,23 @@ impl<T> [T] {
33993416
/// If this slice is not partitioned, the returned result is unspecified and meaningless,
34003417
/// as this method performs a kind of binary search.
34013418
///
3419+
/// See also [`binary_search`], [`binary_search_by`], and [`binary_search_by_key`].
3420+
///
3421+
/// [`binary_search`]: #method.binary_search
3422+
/// [`binary_search_by`]: #method.binary_search_by
3423+
/// [`binary_search_by_key`]: #method.binary_search_by_key
3424+
///
34023425
/// # Examples
34033426
///
34043427
/// ```
3405-
/// #![feature(partition_point)]
3406-
///
34073428
/// let v = [1, 2, 3, 3, 5, 6, 7];
34083429
/// let i = v.partition_point(|&x| x < 5);
34093430
///
34103431
/// assert_eq!(i, 4);
34113432
/// assert!(v[..i].iter().all(|&x| x < 5));
34123433
/// assert!(v[i..].iter().all(|&x| !(x < 5)));
34133434
/// ```
3414-
#[unstable(feature = "partition_point", reason = "new API", issue = "73831")]
3435+
#[stable(feature = "partition_point", since = "1.52.0")]
34153436
pub fn partition_point<P>(&self, mut pred: P) -> usize
34163437
where
34173438
P: FnMut(&T) -> bool,

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
#![feature(option_result_unwrap_unchecked)]
6868
#![feature(option_unwrap_none)]
6969
#![feature(peekable_peek_mut)]
70-
#![feature(partition_point)]
7170
#![feature(once_cell)]
7271
#![feature(unsafe_block_in_unsafe_fn)]
7372
#![feature(int_bits_const)]

0 commit comments

Comments
 (0)