Created
August 19, 2013 05:16
-
-
Save carl-eastlund/6265928 to your computer and use it in GitHub Desktop.
derived cloning, expanded
This file contains hidden or 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
| priv use std::prelude::*; | |
| priv extern mod std; | |
| /* This version works: */ | |
| // Box{ unbox : b.unbox.clone() } | |
| /* This version doesn't: */ | |
| mod __std_macros { | |
| #[macro_escape]; | |
| #[doc(hidden)]; | |
| priv use std::prelude::*; | |
| #[cfg(not(debug))] | |
| #[macro_escape] | |
| mod debug_macro { | |
| priv use std::prelude::*; | |
| } | |
| } | |
| fn main() { } | |
| #[deriving(Clone)] | |
| struct Box<T> { | |
| unbox: @T, | |
| } | |
| #[doc = "Automatically derived."] | |
| pub impl <T: ::std::clone::Clone> ::std::clone::Clone for Box<T> { | |
| fn clone(&self) -> Box<T> { | |
| match *self { | |
| Box{unbox: ref __self_0_0} => Box{unbox: __self_0_0.clone(),} | |
| } | |
| } | |
| } | |
| fn op<T>(b: Box<T>) -> Box<T> { b.clone() } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment