Skip to content

Commit 0d07153

Browse files
committed
add back sort_by_key link, allow linter and add comment
1 parent 14e23f1 commit 0d07153

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

library/core/src/slice/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ impl<T> [T] {
22152215
/// Binary searches this sorted slice with a key extraction function.
22162216
///
22172217
/// Assumes that the slice is sorted by the key, for instance with
2218-
/// `sort_by_key` using the same key extraction function.
2218+
/// [`sort_by_key`] using the same key extraction function.
22192219
///
22202220
/// If the value is found then [`Result::Ok`] is returned, containing the
22212221
/// index of the matching element. If there are multiple matches, then any
@@ -2225,6 +2225,7 @@ impl<T> [T] {
22252225
///
22262226
/// See also [`binary_search`], [`binary_search_by`], and [`partition_point`].
22272227
///
2228+
/// [`sort_by_key`]: slice::sort_by_key
22282229
/// [`binary_search`]: slice::binary_search
22292230
/// [`binary_search_by`]: slice::binary_search_by
22302231
/// [`partition_point`]: slice::partition_point
@@ -2247,6 +2248,10 @@ impl<T> [T] {
22472248
/// let r = s.binary_search_by_key(&1, |&(a, b)| b);
22482249
/// assert!(match r { Ok(1..=4) => true, _ => false, });
22492250
/// ```
2251+
// Lint rustdoc::broken_intra_doc_links is allowed as `slice::sort_by_key` is
2252+
// in crate `alloc`, and as such doesn't exists yet when building `core`
2253+
// links to downstream crate: https://github.com/rust-lang/rust/issues/74481
2254+
#[cfg_attr(not(bootstrap), allow(rustdoc::broken_intra_doc_links))]
22502255
#[stable(feature = "slice_binary_search_by_key", since = "1.10.0")]
22512256
#[inline]
22522257
pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, mut f: F) -> Result<usize, usize>

0 commit comments

Comments
 (0)