Skip to content

Instantly share code, notes, and snippets.

Created October 7, 2016 06:54
Show Gist options
  • Save anonymous/ad14ebed3ca721ab8e9a384e0eefa76c to your computer and use it in GitHub Desktop.
Save anonymous/ad14ebed3ca721ab8e9a384e0eefa76c to your computer and use it in GitHub Desktop.
Shared via Rust Playground
#![feature(unsize)]
use std::fmt::Debug;
use std::marker::Unsize;
fn foo<T: Unsize<Debug> + 'static>(mut t: T) {
let t = unsafe { Box::from_raw(&mut t as *mut _) } as Box<Debug>;
println!("{:?}", t);
}
fn main() {
foo(123);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment