From 51e37880c665b954bed314888ef45abf441d2d81 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 12 Oct 2023 18:59:16 -0700 Subject: [PATCH] Add repr(transparent) to guarantee soundness --- native/src/base/cstr.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/native/src/base/cstr.rs b/native/src/base/cstr.rs index 0fee8cc71..6a10c4af7 100644 --- a/native/src/base/cstr.rs +++ b/native/src/base/cstr.rs @@ -284,6 +284,7 @@ pub enum StrErr { } // UTF-8 validated + null terminated string slice +#[repr(transparent)] pub struct Utf8CStr([u8]); impl Utf8CStr { @@ -381,6 +382,7 @@ impl DerefMut for Utf8CStr { // File system path extensions types +#[repr(transparent)] pub struct FsPath(Utf8CStr); impl FsPath {