Skip to content

slice methods could be added to the array docs #62992

Open
@ExpHP

Description

@ExpHP

(I'm surprised I couldn't find an issue for this!)

The documentation page for the primitive array type ideally should include the methods defined on slices. (see e.g. this report of confusion on the forum)

This could be tricky; it looks like this capability is basically hardcoded into the compiler, so rustdoc would need to special-case it. (it can't rely on Deref like it can for Vec)


As an aside, the page contains some misleading language:

Arrays coerce to slices ([T]), so a slice method may be called on an array.

This suggests that coercions enable method access, but there's plenty of coercions in Rust that do not, including other Unsize coercions like &T -> &dyn Trait.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions