Skip to content

CStr::from_ptr documentation should mention that the C string's data must not change #48401

Closed

Description

Callers of std::ffi::CStr::from_ptr are responsible for ensuring that the bytes pointed to by ptr, up through the terminating null byte, do not change during the lifetime of the returned &CStr. This is arguably implicit in the fact that the return value is a shared reference, but it seems to me it would be helpful to spell it out, along with the other stipulations already listed in from_ptr's documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: documentation for any part of the project, including the compiler, standard library, and toolsArea: documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions