diff --git a/src/lib.rs b/src/lib.rs index e021bfb..4d16d8d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -152,6 +152,13 @@ impl TypeErasedVec { /// Matching size alone is insufficient because the allocation must also have /// the alignment required by `T`. The caller must additionally ensure that /// every existing element is valid as `T` and can be soundly dropped as `T`. + /// + /// ```compile_fail + /// use type_erased_vec_capacity::TypeErasedVec; + /// + /// let mut erased = TypeErasedVec::new(vec![0_u32]); + /// let _guard = erased.cast_type::(); + /// ``` pub unsafe fn cast_type(&mut self) -> ContentGuard<'_, T> { debug_assert_eq!(self.layout, Layout::new::());