Bump version of dyn-any to address missues which could lead to ub (#1145)

* Make StaticType trait unsafe

* Mark StaticTypeSized and StaticTypeClone as unsafe as well

* Update dyn-any dependency

* Update manifest links
This commit is contained in:
Dennis Kobert
2023-04-17 23:35:04 +02:00
committed by Keavon Chambers
parent 9db5ad43bf
commit 1d6c4f13dd
14 changed files with 47 additions and 64 deletions

View File

@@ -42,7 +42,7 @@ impl<'n, T: 'n + dyn_any::StaticTypeSized> FixedSizeStack<T> {
pub fn is_empty(&self) -> bool {
self.len.load(Ordering::SeqCst) == 0
}
pub fn push_fn<'a>(&self, f: impl FnOnce(&'a [T::Static]) -> T) {
pub fn push_fn<'a>(&self, f: impl FnOnce(&'a [<T as StaticTypeSized>::Static]) -> T) {
assert_eq!(std::mem::size_of::<T>(), std::mem::size_of::<T::Static>());
unsafe { self.push(f(self.get())) }
}