• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 pub trait Element<S> {
2     type Array;
3 }
4 
5 impl<T> Element<()> for T {
6     type Array = T;
7 }
8 
9 impl<T: Element<S>, S> Element<[S; 3]> for T {
10     type Array = [T::Array; 3];
11 }
12 
13 trait Foo<I>
14 where
15     u8: Element<I>,
16 {
foo(self, x: <u8 as Element<I>>::Array)17     fn foo(self, x: <u8 as Element<I>>::Array);
18 }
19 
20 impl<I> Foo<I> for u16
21 where
22     u8: Element<I>,
23 {
foo(self, _: <u8 as Element<I>>::Array)24     fn foo(self, _: <u8 as Element<I>>::Array) {}
25 }
26 
main()27 fn main() {
28     let b: [u8; 3] = [0u8; 3];
29 
30     0u16.foo(b); //~ ERROR type annotations needed
31     //~^ ERROR type annotations needed
32     //<u16 as Foo<[(); 3]>>::foo(0u16, b);
33 }
34