Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Foo {
- const U: usize;
- }
- trait Bar<T: Foo> {
- const V: usize = 5 - T::U;
- }
- impl<T: Foo> Bar<T> for T {
- }
- impl Foo for u32 {
- const U: usize = 6;
- }
- fn foo<T: Foo>(t: T) -> T {
- let x = T::V;
- println!("{}", x);
- t
- }
- fn main() {
- // uncomment for error
- //foo(5u32);
- }
Add Comment
Please, Sign In to add comment