Guest User

Untitled

a guest
Jul 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. trait Foo {
  2. const U: usize;
  3. }
  4.  
  5. trait Bar<T: Foo> {
  6. const V: usize = 5 - T::U;
  7. }
  8.  
  9. impl<T: Foo> Bar<T> for T {
  10. }
  11.  
  12. impl Foo for u32 {
  13. const U: usize = 6;
  14. }
  15.  
  16. fn foo<T: Foo>(t: T) -> T {
  17. let x = T::V;
  18. println!("{}", x);
  19. t
  20. }
  21.  
  22. fn main() {
  23. // uncomment for error
  24. //foo(5u32);
  25. }
Add Comment
Please, Sign In to add comment