Skip to content

Commit

Permalink
Make os_str_bytes::{Buf, Slice} pub and repr(transparent)
Browse files Browse the repository at this point in the history
  • Loading branch information
CDirkx committed Jun 20, 2021
1 parent 1a96d22 commit 835561a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions library/std/src/sys_common/os_str_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@ use crate::sys_common::{AsInner, IntoInner};
use core::str::lossy::Utf8Lossy;

#[derive(Hash)]
pub(crate) struct Buf {
#[repr(transparent)]
pub struct Buf {
pub inner: Vec<u8>,
}

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

Expand Down

0 comments on commit 835561a

Please sign in to comment.