https://github.com/oli-obk/rust-traitobject

--- cargo-crates/traitobject-0.1.0/Cargo.toml.orig	2025-05-20 19:05:49.922093000 +0200
+++ cargo-crates/traitobject-0.1.0/Cargo.toml	2025-05-20 19:06:16.369816000 +0200
@@ -7,4 +7,4 @@ license = "MIT/Apache-2.0"
 description = "Unsafe helpers for working with raw trait objects."
 readme = "README.md"
 license = "MIT/Apache-2.0"
-
+edition = "2021"
--- cargo-crates/traitobject-0.1.0/src/impls.rs.orig	2025-05-20 18:52:30.435009000 +0200
+++ cargo-crates/traitobject-0.1.0/src/impls.rs	2025-05-20 19:02:42.948378000 +0200
@@ -1,82 +1,75 @@
-use Trait;
+use super::Trait;
 
-unsafe impl Trait for ::std::any::Any + Send { }
-unsafe impl Trait for ::std::any::Any + Sync { }
-unsafe impl Trait for ::std::any::Any + Send + Sync { }
-unsafe impl<T: ?Sized> Trait for ::std::borrow::Borrow<T> + Send { }
-unsafe impl<T: ?Sized> Trait for ::std::borrow::Borrow<T> + Sync { }
-unsafe impl<T: ?Sized> Trait for ::std::borrow::Borrow<T> + Send + Sync { }
-unsafe impl<T: ?Sized> Trait for ::std::borrow::BorrowMut<T> + Send { }
-unsafe impl<T: ?Sized> Trait for ::std::borrow::BorrowMut<T> + Sync { }
-unsafe impl<T: ?Sized> Trait for ::std::borrow::BorrowMut<T> + Send + Sync { }
-unsafe impl<T: ?Sized> Trait for ::std::convert::AsMut<T> + Send { }
-unsafe impl<T: ?Sized> Trait for ::std::convert::AsMut<T> + Sync { }
-unsafe impl<T: ?Sized> Trait for ::std::convert::AsMut<T> + Send + Sync { }
-unsafe impl<T: ?Sized> Trait for ::std::convert::AsRef<T> + Send { }
-unsafe impl<T: ?Sized> Trait for ::std::convert::AsRef<T> + Sync { }
-unsafe impl<T: ?Sized> Trait for ::std::convert::AsRef<T> + Send + Sync { }
-unsafe impl Trait for ::std::error::Error + Send { }
-unsafe impl Trait for ::std::error::Error + Sync { }
-unsafe impl Trait for ::std::error::Error + Send + Sync { }
-unsafe impl Trait for ::std::fmt::Binary + Send { }
-unsafe impl Trait for ::std::fmt::Binary + Sync { }
-unsafe impl Trait for ::std::fmt::Binary + Send + Sync { }
-unsafe impl Trait for ::std::fmt::Debug + Send { }
-unsafe impl Trait for ::std::fmt::Debug + Sync { }
-unsafe impl Trait for ::std::fmt::Debug + Send + Sync { }
-unsafe impl Trait for ::std::fmt::Display + Send { }
-unsafe impl Trait for ::std::fmt::Display + Sync { }
-unsafe impl Trait for ::std::fmt::Display + Send + Sync { }
-unsafe impl Trait for ::std::fmt::LowerExp + Send { }
-unsafe impl Trait for ::std::fmt::LowerExp + Sync { }
-unsafe impl Trait for ::std::fmt::LowerExp + Send + Sync { }
-unsafe impl Trait for ::std::fmt::LowerHex + Send { }
-unsafe impl Trait for ::std::fmt::LowerHex + Sync { }
-unsafe impl Trait for ::std::fmt::LowerHex + Send + Sync { }
-unsafe impl Trait for ::std::fmt::Octal + Send { }
-unsafe impl Trait for ::std::fmt::Octal + Sync { }
-unsafe impl Trait for ::std::fmt::Octal + Send + Sync { }
-unsafe impl Trait for ::std::fmt::Pointer + Send { }
-unsafe impl Trait for ::std::fmt::Pointer + Sync { }
-unsafe impl Trait for ::std::fmt::Pointer + Send + Sync { }
-unsafe impl Trait for ::std::fmt::UpperExp + Send { }
-unsafe impl Trait for ::std::fmt::UpperExp + Sync { }
-unsafe impl Trait for ::std::fmt::UpperExp + Send + Sync { }
-unsafe impl Trait for ::std::fmt::UpperHex + Send { }
-unsafe impl Trait for ::std::fmt::UpperHex + Sync { }
-unsafe impl Trait for ::std::fmt::UpperHex + Send + Sync { }
-unsafe impl Trait for ::std::fmt::Write + Send { }
-unsafe impl Trait for ::std::fmt::Write + Sync { }
-unsafe impl Trait for ::std::fmt::Write + Send + Sync { }
-unsafe impl Trait for ::std::hash::Hasher + Send { }
-unsafe impl Trait for ::std::hash::Hasher + Sync { }
-unsafe impl Trait for ::std::hash::Hasher + Send + Sync { }
-unsafe impl Trait for ::std::io::BufRead + Send { }
-unsafe impl Trait for ::std::io::BufRead + Sync { }
-unsafe impl Trait for ::std::io::BufRead + Send + Sync { }
-unsafe impl Trait for ::std::io::Read + Send { }
-unsafe impl Trait for ::std::io::Read + Sync { }
-unsafe impl Trait for ::std::io::Read + Send + Sync { }
-unsafe impl Trait for ::std::io::Seek + Send { }
-unsafe impl Trait for ::std::io::Seek + Sync { }
-unsafe impl Trait for ::std::io::Seek + Send + Sync { }
-unsafe impl Trait for ::std::io::Write + Send { }
-unsafe impl Trait for ::std::io::Write + Sync { }
-unsafe impl Trait for ::std::io::Write + Send + Sync { }
-unsafe impl<T, I> Trait for ::std::iter::IntoIterator<IntoIter=I, Item=T> { }
-unsafe impl<T> Trait for ::std::iter::Iterator<Item=T> + Send { }
-unsafe impl<T> Trait for ::std::iter::Iterator<Item=T> + Sync { }
-unsafe impl<T> Trait for ::std::iter::Iterator<Item=T> + Send + Sync { }
-unsafe impl Trait for ::std::marker::Send + Send { }
-unsafe impl Trait for ::std::marker::Send + Sync { }
-unsafe impl Trait for ::std::marker::Send + Send + Sync { }
-unsafe impl Trait for ::std::marker::Sync + Send { }
-unsafe impl Trait for ::std::marker::Sync + Sync { }
-unsafe impl Trait for ::std::marker::Sync + Send + Sync { }
-unsafe impl Trait for ::std::ops::Drop + Send { }
-unsafe impl Trait for ::std::ops::Drop + Sync { }
-unsafe impl Trait for ::std::ops::Drop + Send + Sync { }
-unsafe impl Trait for ::std::string::ToString + Send { }
-unsafe impl Trait for ::std::string::ToString + Sync { }
-unsafe impl Trait for ::std::string::ToString + Send + Sync { }
-
+unsafe impl Trait for dyn ::std::any::Any + Send {}
+unsafe impl Trait for dyn ::std::any::Any + Sync {}
+unsafe impl Trait for dyn ::std::any::Any + Send + Sync {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::borrow::Borrow<T> + Send {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::borrow::Borrow<T> + Sync {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::borrow::Borrow<T> + Send + Sync {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::borrow::BorrowMut<T> + Send {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::borrow::BorrowMut<T> + Sync {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::borrow::BorrowMut<T> + Send + Sync {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::convert::AsMut<T> + Send {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::convert::AsMut<T> + Sync {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::convert::AsMut<T> + Send + Sync {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::convert::AsRef<T> + Send {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::convert::AsRef<T> + Sync {}
+unsafe impl<T: ?Sized> Trait for dyn ::std::convert::AsRef<T> + Send + Sync {}
+unsafe impl Trait for dyn ::std::error::Error + Send {}
+unsafe impl Trait for dyn ::std::error::Error + Sync {}
+unsafe impl Trait for dyn ::std::error::Error + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Binary + Send {}
+unsafe impl Trait for dyn ::std::fmt::Binary + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Binary + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Debug + Send {}
+unsafe impl Trait for dyn ::std::fmt::Debug + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Debug + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Display + Send {}
+unsafe impl Trait for dyn ::std::fmt::Display + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Display + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::LowerExp + Send {}
+unsafe impl Trait for dyn ::std::fmt::LowerExp + Sync {}
+unsafe impl Trait for dyn ::std::fmt::LowerExp + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::LowerHex + Send {}
+unsafe impl Trait for dyn ::std::fmt::LowerHex + Sync {}
+unsafe impl Trait for dyn ::std::fmt::LowerHex + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Octal + Send {}
+unsafe impl Trait for dyn ::std::fmt::Octal + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Octal + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Pointer + Send {}
+unsafe impl Trait for dyn ::std::fmt::Pointer + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Pointer + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::UpperExp + Send {}
+unsafe impl Trait for dyn ::std::fmt::UpperExp + Sync {}
+unsafe impl Trait for dyn ::std::fmt::UpperExp + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::UpperHex + Send {}
+unsafe impl Trait for dyn ::std::fmt::UpperHex + Sync {}
+unsafe impl Trait for dyn ::std::fmt::UpperHex + Send + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Write + Send {}
+unsafe impl Trait for dyn ::std::fmt::Write + Sync {}
+unsafe impl Trait for dyn ::std::fmt::Write + Send + Sync {}
+unsafe impl Trait for dyn ::std::hash::Hasher + Send {}
+unsafe impl Trait for dyn ::std::hash::Hasher + Sync {}
+unsafe impl Trait for dyn ::std::hash::Hasher + Send + Sync {}
+unsafe impl Trait for dyn ::std::io::BufRead + Send {}
+unsafe impl Trait for dyn ::std::io::BufRead + Sync {}
+unsafe impl Trait for dyn ::std::io::BufRead + Send + Sync {}
+unsafe impl Trait for dyn ::std::io::Read + Send {}
+unsafe impl Trait for dyn ::std::io::Read + Sync {}
+unsafe impl Trait for dyn ::std::io::Read + Send + Sync {}
+unsafe impl Trait for dyn ::std::io::Seek + Send {}
+unsafe impl Trait for dyn ::std::io::Seek + Sync {}
+unsafe impl Trait for dyn ::std::io::Seek + Send + Sync {}
+unsafe impl Trait for dyn ::std::io::Write + Send {}
+unsafe impl Trait for dyn ::std::io::Write + Sync {}
+unsafe impl Trait for dyn ::std::io::Write + Send + Sync {}
+unsafe impl<T, I> Trait for dyn (::std::iter::IntoIterator<IntoIter = I, Item = T>) {}
+unsafe impl<T> Trait for dyn ::std::iter::Iterator<Item = T> + Send {}
+unsafe impl<T> Trait for dyn ::std::iter::Iterator<Item = T> + Sync {}
+unsafe impl<T> Trait for dyn ::std::iter::Iterator<Item = T> + Send + Sync {}
+unsafe impl Trait for dyn ::std::marker::Send + Send {}
+unsafe impl Trait for dyn ::std::marker::Send + Sync {}
+unsafe impl Trait for dyn ::std::marker::Sync + Sync {}
+unsafe impl Trait for dyn ::std::string::ToString + Send {}
+unsafe impl Trait for dyn ::std::string::ToString + Sync {}
+unsafe impl Trait for dyn ::std::string::ToString + Send + Sync {}
--- cargo-crates/traitobject-0.1.0/src/lib.rs.orig	2025-05-20 19:03:33.859314000 +0200
+++ cargo-crates/traitobject-0.1.0/src/lib.rs	2025-05-20 19:03:37.867025000 +0200
@@ -5,26 +5,24 @@
 //!
 //! Unsafe helpers for working with raw TraitObjects.
 
-use std::mem;
-
 /// Get the data pointer from this trait object.
 ///
 /// Highly unsafe, as there is no information about the type of the data.
 pub unsafe fn data<T: ?Sized>(val: *const T) -> *const () {
-    *mem::transmute::<*const *const T, *const *const ()>(&val)
+    val as *const ()
 }
 
 /// Get the data pointer from this trait object, mutably.
 ///
 /// Highly unsafe, as there is no information about the type of the data.
-pub unsafe fn data_mut<T: ?Sized>(mut val: *mut T) -> *mut () {
-    *mem::transmute::<*mut *mut T, *mut *mut ()>(&mut val)
+pub unsafe fn data_mut<T: ?Sized>(val: *mut T) -> *mut () {
+    val as *mut ()
 }
 
 #[test]
 fn test_simple() {
-    let x = &7 as &Send;
-    unsafe { assert!(&7 == mem::transmute::<_, &i32>(data(x))) };
+    let x = &7 as &dyn Send;
+    unsafe { assert!(&7 == std::mem::transmute::<_, &i32>(data(x))) };
 }
 
 /// A trait implemented for all trait objects.
@@ -33,4 +31,3 @@ mod impls;
 pub unsafe trait Trait {}
 
 mod impls;
-
