Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #![allow(dead_code)]
  2.  
  3. pub trait Quux { type Assoc; }
  4. pub trait Foo<T> { }
  5. pub trait Bar { }
  6.  
  7. struct S1;
  8. struct S2;
  9. struct S3;
  10. struct S4;
  11.  
  12. impl Quux for S1 { type Assoc = S2; }
  13. impl Foo<S3> for S2 { }
  14. impl Bar for S3 { }
  15. impl Bar for S4 { }
  16.  
  17. // The presence/absence of this line dictates whether
  18. // we get inference failures or not
  19. // impl Foo<S4> for S2 { }
  20.  
  21. pub fn foobar(_: impl Quux<Assoc=impl Foo<impl Bar>>) {
  22.  
  23. }
  24.  
  25. fn main() {
  26. foobar(S1);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement