Skip to content

Instantly share code, notes, and snippets.

@sinkuu
Forked from anonymous/playground.rs
Created October 7, 2016 06:55
Show Gist options
  • Save sinkuu/98cd4c0e023393bf8550aa4db980092c to your computer and use it in GitHub Desktop.
Save sinkuu/98cd4c0e023393bf8550aa4db980092c 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