Skip to content

Commit 835561a

Browse files
committed
Make os_str_bytes::{Buf, Slice} pub and repr(transparent)
1 parent 1a96d22 commit 835561a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

library/std/src/sys_common/os_str_bytes.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,13 @@ use crate::sys_common::{AsInner, IntoInner};
1414
use core::str::lossy::Utf8Lossy;
1515

1616
#[derive(Hash)]
17-
pub(crate) struct Buf {
17+
#[repr(transparent)]
18+
pub struct Buf {
1819
pub inner: Vec<u8>,
1920
}
2021

21-
// FIXME:
22-
// `Buf::as_slice` current implementation relies
23-
// on `Slice` being layout-compatible with `[u8]`.
24-
// When attribute privacy is implemented, `Slice` should be annotated as `#[repr(transparent)]`.
25-
// Anyway, `Slice` representation and layout are considered implementation detail, are
26-
// not documented and must not be relied upon.
27-
pub(crate) struct Slice {
22+
#[repr(transparent)]
23+
pub struct Slice {
2824
pub inner: [u8],
2925
}
3026

0 commit comments

Comments
 (0)