Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
81c068a
install tools documentations
onur-ozkan Feb 14, 2024
e4a15d4
don't use entire sysroot binary path for rustc tarballs
onur-ozkan Feb 14, 2024
75af3c5
coverage: Regression test for a span extraction inconsistency
Zalathar Feb 15, 2024
cd9021e
coverage: Discard spans that fill the entire function body
Zalathar Feb 15, 2024
9b3fcf9
Detect when method call on argument could be removed to fulfill faile…
estebank Feb 14, 2024
cd1f608
const_mut_refs: allow mutable refs to statics
RalfJung Feb 11, 2024
b49bd0b
Add examples to document the return type of `select_nth_unstable`, `s…
Takashiidobe Feb 16, 2024
3250e95
Add a simple extension trait derive
compiler-errors Feb 13, 2024
9c25823
Use extension trait derive
compiler-errors Feb 13, 2024
a9dbf63
Move trait into attr so it's greppable
compiler-errors Feb 14, 2024
f624d55
Nits
compiler-errors Feb 16, 2024
4071938
Use a hardcoded constant instead of calling OpenProcessToken.
smmalis37 Dec 17, 2023
3b63ede
Remove cfg_attr
smmalis37 Feb 16, 2024
53239d8
Rollup merge of #119032 - smmalis37:patch-1, r=ChrisDenton
Nadrieril Feb 17, 2024
c5ffa54
Rollup merge of #120932 - RalfJung:mut-ptr-to-static, r=oli-obk
Nadrieril Feb 17, 2024
9ccabc8
Rollup merge of #121059 - compiler-errors:extension, r=davidtwco,Nils…
Nadrieril Feb 17, 2024
c2b02e4
Rollup merge of #121079 - onur-ozkan:install-conflicts, r=albertlarsan68
Nadrieril Feb 17, 2024
7fedf99
Rollup merge of #121100 - estebank:issue-71252, r=compiler-errors
Nadrieril Feb 17, 2024
134d9d0
Rollup merge of #121135 - Zalathar:no-whole-body-span, r=wesleywiser
Nadrieril Feb 17, 2024
45bcbfb
Rollup merge of #121187 - Takashiidobe:takashi/examples-for-quicksele…
Nadrieril Feb 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add examples to document the return type of select_nth_unstable, `s…
…elect_nth_unstable_by`, and `select_nth_unstable_by_key`.
  • Loading branch information
Takashiidobe committed Feb 16, 2024
commit b49bd0bba00e5622917db09cb70f42e47d322df8
27 changes: 21 additions & 6 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3016,8 +3016,13 @@ impl<T> [T] {
/// ```
/// let mut v = [-5i32, 4, 2, -3, 1];
///
/// // Find the median
/// v.select_nth_unstable(2);
/// // Find the items less than or equal to the median, the median, and greater than or equal to
/// // the median.
/// let (lesser, median, greater) = v.select_nth_unstable(2);
///
/// assert!(lesser == [-3, -5] || lesser == [-5, -3]);
/// assert_eq!(median, &mut 1);
/// assert!(greater == [4, 2] || greater == [2, 4]);
///
/// // We are only guaranteed the slice will be one of the following, based on the way we sort
/// // about the specified index.
Expand Down Expand Up @@ -3067,8 +3072,13 @@ impl<T> [T] {
/// ```
/// let mut v = [-5i32, 4, 2, -3, 1];
///
/// // Find the median as if the slice were sorted in descending order.
/// v.select_nth_unstable_by(2, |a, b| b.cmp(a));
/// // Find the items less than or equal to the median, the median, and greater than or equal to
/// // the median as if the slice were sorted in descending order.
/// let (lesser, median, greater) = v.select_nth_unstable_by(2, |a, b| b.cmp(a));
///
/// assert!(lesser == [4, 2] || lesser == [2, 4]);
/// assert_eq!(median, &mut 1);
/// assert!(greater == [-3, -5] || greater == [-5, -3]);
///
/// // We are only guaranteed the slice will be one of the following, based on the way we sort
/// // about the specified index.
Expand Down Expand Up @@ -3122,8 +3132,13 @@ impl<T> [T] {
/// ```
/// let mut v = [-5i32, 4, 1, -3, 2];
///
/// // Return the median as if the array were sorted according to absolute value.
/// v.select_nth_unstable_by_key(2, |a| a.abs());
/// // Find the items less than or equal to the median, the median, and greater than or equal to
/// // the median as if the slice were sorted according to absolute value.
/// let (lesser, median, greater) = v.select_nth_unstable_by_key(2, |a| a.abs());
///
/// assert!(lesser == [1, 2] || lesser == [2, 1]);
/// assert_eq!(median, &mut -3);
/// assert!(greater == [4, -5] || greater == [-5, 4]);
///
/// // We are only guaranteed the slice will be one of the following, based on the way we sort
/// // about the specified index.
Expand Down