Fix dropping issues with StaticVec and use it everywhere.
This commit is contained in:
@@ -47,9 +47,9 @@ pub fn unsafe_cast_box<X: Variant, T: Variant>(item: Box<X>) -> Result<Box<T>, B
|
||||
/// current `Scope` without cloning the variable name. Doing this is safe because all local
|
||||
/// variables in the `Scope` are cleared out before existing the block.
|
||||
///
|
||||
/// Force-casting a local variable lifetime to the current `Scope`'s larger lifetime saves
|
||||
/// Force-casting a local variable's lifetime to the current `Scope`'s larger lifetime saves
|
||||
/// on allocations and string cloning, thus avoids us having to maintain a chain of `Scope`'s.
|
||||
pub fn unsafe_cast_var_name<'s>(name: &str, state: &State) -> Cow<'s, str> {
|
||||
pub fn unsafe_cast_var_name_to_lifetime<'s>(name: &str, state: &State) -> Cow<'s, str> {
|
||||
// If not at global level, we can force-cast
|
||||
if state.scope_level > 0 {
|
||||
// WARNING - force-cast the variable name into the scope's lifetime to avoid cloning it
|
||||
@@ -62,7 +62,7 @@ pub fn unsafe_cast_var_name<'s>(name: &str, state: &State) -> Cow<'s, str> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Provide a type instance that is memory-zeroed.
|
||||
pub fn unsafe_zeroed<T>() -> T {
|
||||
unsafe { mem::MaybeUninit::zeroed().assume_init() }
|
||||
/// Provide a type instance that is uninitialized.
|
||||
pub fn unsafe_uninit<T>() -> T {
|
||||
unsafe { mem::MaybeUninit::uninit().assume_init() }
|
||||
}
|
||||
|
Reference in New Issue
Block a user