Created
October 7, 2016 06:54
-
-
Save anonymous/ad14ebed3ca721ab8e9a384e0eefa76c to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![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