Prevent GraphemeStrs created from Strings from leaking (#7920)
This commit is contained in:
parent
ee3171cc54
commit
01776e6851
1 changed files with 1 additions and 1 deletions
|
@ -481,7 +481,7 @@ impl<'a> From<String> for GraphemeStr<'a> {
|
||||||
let ptr = Box::into_raw(g.into_bytes().into_boxed_slice()) as *mut u8;
|
let ptr = Box::into_raw(g.into_bytes().into_boxed_slice()) as *mut u8;
|
||||||
GraphemeStr {
|
GraphemeStr {
|
||||||
ptr: unsafe { NonNull::new_unchecked(ptr) },
|
ptr: unsafe { NonNull::new_unchecked(ptr) },
|
||||||
len: i32::try_from(len).unwrap() as u32,
|
len: (i32::try_from(len).unwrap() as u32) | Self::MASK_OWNED,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue