Implement preinit related features in Rust

This commit is contained in:
topjohnwu
2024-03-28 14:11:03 -07:00
parent 1eddbfd72c
commit a1b6568226
13 changed files with 312 additions and 164 deletions

View File

@@ -451,6 +451,7 @@ pub struct FsPathBuf<'a>(&'a mut dyn Utf8CStrWrite);
impl<'a> FsPathBuf<'a> {
pub fn new(value: &'a mut dyn Utf8CStrWrite) -> Self {
value.clear();
FsPathBuf(value)
}
@@ -656,7 +657,8 @@ macro_rules! cstr {
);
#[allow(unused_unsafe)]
unsafe {
$crate::Utf8CStr::from_bytes_unchecked(concat!($($str)*, "\0").as_bytes())
$crate::Utf8CStr::from_bytes_unchecked($crate::const_format::concatcp!($($str)*, "\0")
.as_bytes())
}
}};
}