Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. trait Trait {
  2. type Associated;
  3. }
  4.  
  5.  
  6.  
  7. struct Base;
  8.  
  9. impl Trait for Base {
  10. type Associated = u32;
  11. }
  12.  
  13. #[derive(Copy, Clone)]
  14. struct Foo<E: Trait> {
  15. s: E::Associated,
  16. }
  17.  
  18.  
  19. // just checks that T implement copy
  20. fn assert_copy<T:Copy>(t:T) {}
  21.  
  22.  
  23. fn main () {
  24. assert_copy(Foo::<Base>{s:12})
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement