Skip to content

Commit

Permalink
Add repr(transparent) to guarantee soundness
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Oct 13, 2023
1 parent 4b83c1e commit 51e3788
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions native/src/base/cstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ pub enum StrErr {
}

// UTF-8 validated + null terminated string slice
#[repr(transparent)]
pub struct Utf8CStr([u8]);

impl Utf8CStr {
Expand Down Expand Up @@ -381,6 +382,7 @@ impl DerefMut for Utf8CStr {

// File system path extensions types

#[repr(transparent)]
pub struct FsPath(Utf8CStr);

impl FsPath {
Expand Down

0 comments on commit 51e3788

Please sign in to comment.