{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreidn53xpgcunowadwvqadybo6532u2xtqldybvi5wlcw6xz7ewynoi",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mmsbjs2bexr2"
},
"path": "/t/pre-rfc-guarantee-that-pointers-to-osstr-has-the-same-layout-as-pointers-to-str-u8/24354#post_4",
"publishedAt": "2026-05-26T23:58:00.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "Not advocating for this, but _hypothetically_ , the first 1-4 bytes of an `OsStr`-with-locale-info could be invalid UTF-8 to signify the presence of locale information, and valid UTF-8 to signify that no locale information was provided (supporting `str: AsRef<OsStr>`).\n\n_Maybe_ there would be some advantage of allowing the locale info to contain a pointer (precluding the use of `[u8]`). Or the locale info could just be encoded into a fancy `[u8]`.\n\nEdit: wait, that's about the backing data, not the pointer to it.\n\nI suppose that storing locale info in the backing data would have the disadvantage of requiring a `&mut OsStr` instead of a `&mut &OsStr` to change the locale.",
"title": "Pre-RFC: Guarantee that pointers to `OsStr` has the same layout as pointers to `str`/`[u8]`"
}