Guest User

Untitled

a guest
Jul 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. //#[derive(Clone, Copy)]
  2. struct Copyable<'a, N: 'static> {
  3. #[allow(dead_code)]
  4. field: &'a N,
  5. }
  6.  
  7. impl<'a, N> Clone for Copyable<'a, N> {
  8. fn clone(&self) -> Self {
  9. *self
  10. }
  11. }
  12.  
  13. impl<'a, N> Copy for Copyable<'a, N> {
  14. }
  15.  
  16. struct NonCopy;
  17.  
  18. fn main() {
  19. let thing = NonCopy;
  20.  
  21. let copyable = Copyable {
  22. field: &thing,
  23. };
  24.  
  25. drop(copyable);
  26. drop(copyable);
  27. }
Add Comment
Please, Sign In to add comment