Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. trait Object<U> {
  2. type Output;
  3. }
  4.  
  5. impl<T: ?Sized, U> Object<U> for T {
  6. type Output = U;
  7. }
  8.  
  9. fn foo<T: ?Sized, U>(x: <T as Object<U>>::Output) -> U {
  10. x
  11. }
  12.  
  13. fn transmute<T, U>(x: T) -> U {
  14. foo::<dyn Object<U, Output = T>, U>(x)
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement