Skip to content

select_nth documentation is insufficient #97982

Closed
@TheIronBorn

Description

@TheIronBorn

The documentation's description of the return values is slightly incorrect.

/// element" in other libraries. It returns a triplet of the following values: all elements less
/// than the one at the given index, the value at the given index, and all elements greater than
/// the one at the given index.

The following code however, produces ([1, 1], 1, [1, 1]):

let mut v = [1i32; 5];
let (x, y, z) = v.select_nth_unstable(2);

(playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3c68d77916745c6442866324d675755d)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions