Skip to content

OsString::into_encoded_bytes points to wrong from_encoded_bytes_unchecked for round trip #133010

Closed
@lolbinarycat

Description

@lolbinarycat

Location

https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.into_encoded_bytes

Summary

contains this line:

To convert the byte slice back into an OsString, use the OsStr::from_encoded_bytes_unchecked function

however, if you want a proper round trip, you need to use OsString::from_encoded_bytes_unchecked, which actually consumes the Vec instead of taking a byte slice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library 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