Audit scoped re-erasure invariant

This commit is contained in:
2026-07-31 04:16:51 +02:00
parent dd9a2508bb
commit 34e88fb4e4
2 changed files with 5 additions and 3 deletions
-1
View File
@@ -52,7 +52,6 @@ impl<T> fmt::Debug for ContentGuard<'_, T> {
impl<'vec, T> ContentGuard<'vec, T> {
pub(crate) fn new_scoped(erased: &'vec mut TypeErasedVec) -> Self {
debug_assert!(!std::mem::needs_drop::<T>());
Self {
erased,
reerase: TypeErasedVec::new_scoped,
+5 -2
View File
@@ -76,8 +76,11 @@ impl TypeErasedVec {
}
fn new_scoped<T>(vec: Vec<T>) -> Self {
// `ContentGuard::new_scoped` is only constructed after
// `try_as_type_scoped` has rejected types that need drop.
debug_assert!(
!std::mem::needs_drop::<T>(),
"scoped element types must not require drop"
);
Self {
parts: VecParts::from_vec(vec),
layout: Layout::new::<T>(),