Guest User

Untitled

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