Last active
December 21, 2015 06:39
-
-
Save carl-eastlund/6265900 to your computer and use it in GitHub Desktop.
derived cloning
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
| fn main (){} | |
| #[deriving(Clone)] | |
| struct Box<T>{unbox:@T} | |
| fn op<T>( b : Box<T> ) -> Box<T> { | |
| /* This version works: */ | |
| // Box{ unbox : b.unbox.clone() } | |
| /* This version doesn't: */ | |
| b.clone() | |
| } | |
| /* | |
| clone.rs:13:4: 15:1 error: failed to find an implementation of trait std::clone::Clone for T | |
| clone.rs:13 b.clone() | |
| clone.rs:14 | |
| clone.rs:15 } | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment