We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ac40b6 commit 9c0f3f7Copy full SHA for 9c0f3f7
src/libstd/path.rs
@@ -296,6 +296,13 @@ where
296
}
297
298
// See note at the top of this module to understand why these are used:
299
+//
300
+// These casts are safe as OsStr is internally a wrapper around [u8] on all
301
+// platforms.
302
303
+// Note that currently this relies on the special knowledge that libstd has;
304
+// these types are single-element structs but are not marked repr(transparent)
305
+// or repr(C) which would make these casts allowable outside std.
306
fn os_str_as_u8_slice(s: &OsStr) -> &[u8] {
307
unsafe { &*(s as *const OsStr as *const [u8]) }
308
0 commit comments