Skip to content

Instantly share code, notes, and snippets.

@carl-eastlund
Last active December 21, 2015 06:39
Show Gist options
  • Select an option

  • Save carl-eastlund/6265900 to your computer and use it in GitHub Desktop.

Select an option

Save carl-eastlund/6265900 to your computer and use it in GitHub Desktop.
derived cloning
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