Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. fn main() {
  2. let a = "foo".to_owned();
  3. let b = &a as *const String;
  4. let c = b as *const dyn core::fmt::Debug;
  5. // let d = c as *const dyn core::fmt::Display;
  6. let d = unsafe { core::mem::transmute::<_, *const dyn core::fmt::Display>(c) };
  7. println!("{}", unsafe { &*d });
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement