-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify [T]::select_nth_unstable*
return values
#98111
Conversation
In cases where the nth element is not unique within the slice, it is not correct to say that the values in the returned triplet include ones for "all elements" less/greater than that at the given index: indeed one (or more) such values would then laso contain values equal to that at the given index. The text proposed here clarifies exactly what is returned, but in so doing it is also documenting an implementation detail that previously wasn't detailed: namely that the return slices are slices into the reordered slice. I don't think this can be contentious, because the lifetimes of those returned slices are bound to that of the original (now reordered) slice—so there really isn't any other reasonable implementation that could have this behaviour; but nevertheless it's probably best if @rust-lang/libs-api give it a nod? Fixes rust-lang#97982 r? m-ou-se @rustbot label +A-docs C-bug +T-libs-api
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @thomcc (rust-highfive has picked a reviewer for you, use r? to override) |
Thanks! @bors r+ rollup |
…fee1-dead Rollup of 8 pull requests Successful merges: - rust-lang#98111 (Clarify `[T]::select_nth_unstable*` return values) - rust-lang#101431 (Look at move place's type when suggesting mutable reborrow) - rust-lang#101800 (Constify slice.split_at_mut(_unchecked)) - rust-lang#101997 (Remove support for legacy PM) - rust-lang#102194 (Note the type when unable to drop values in compile time) - rust-lang#102200 (Constify Default impl's for Arrays and Tuples.) - rust-lang#102245 (Constify cmp_min_max_by.) - rust-lang#102259 (Type-annotate and simplify documentation of Option::unwrap_or_default) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
In cases where the nth element is not unique within the slice, it is not
correct to say that the values in the returned triplet include ones for
"all elements" less/greater than that at the given index: indeed one (or
more) such values would then also contain elements equal to that at
the given index.
The text proposed here clarifies exactly what is returned, but in so
doing it is also documenting an implementation detail that previously
wasn't detailed: namely that the returned slices are slices into the
reordered slice. I don't think this can be contentious, because the
lifetimes of those returned slices are bound to that of the original
(now reordered) slice—so there really isn't any other reasonable
implementation that could have this behaviour; but nevertheless it's
probably best if @rust-lang/libs-api give it a nod?
Fixes #97982
r? @m-ou-se
@rustbot label +A-docs +C-bug +T-libs-api -T-libs