Skip to content

slice::fill documentation does not mention usage with uninitialized memory #119423

@FreezyLemon

Description

@FreezyLemon

Location

https://doc.rust-lang.org/std/primitive.slice.html#method.fill

Summary

slice::fill has an alias memset which implies it can be used when self's underlying memory is uninitialized.

The description for slice::fill is very short and does not mention this use case, so it seems unclear if this is intended behaviour or not. Some external discussions already mention the function as a safe way to initialize memory with a T: Clone type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-discussionCategory: Discussion or questions that doesn't represent real issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions