|
1 |
| -//~ ERROR overflow evaluating the requirement `([isize; 0], _): Sized |
2 |
| - |
3 | 1 | trait Foo<A> {
|
4 |
| - fn get(&self, A: &A) { } |
| 2 | + fn get(&self, A: &A) {} |
5 | 3 | }
|
6 | 4 |
|
7 | 5 | trait Bar {
|
8 | 6 | type Out;
|
9 | 7 | }
|
10 | 8 |
|
11 |
| -impl<T> Foo<T> for [isize;0] { |
| 9 | +impl<T> Foo<T> for [isize; 0] { |
12 | 10 | // OK, T is used in `Foo<T>`.
|
13 | 11 | }
|
14 | 12 |
|
15 |
| -impl<T,U> Foo<T> for [isize;1] { |
| 13 | +impl<T, U> Foo<T> for [isize; 1] { |
16 | 14 | //~^ ERROR the type parameter `U` is not constrained
|
17 | 15 | }
|
18 | 16 |
|
19 |
| -impl<T,U> Foo<T> for [isize;2] where T : Bar<Out=U> { |
| 17 | +impl<T, U> Foo<T> for [isize; 2] |
| 18 | +where |
| 19 | + T: Bar<Out = U>, |
| 20 | +{ |
20 | 21 | // OK, `U` is now constrained by the output type parameter.
|
21 | 22 | }
|
22 | 23 |
|
23 |
| -impl<T:Bar<Out=U>,U> Foo<T> for [isize;3] { |
| 24 | +impl<T: Bar<Out = U>, U> Foo<T> for [isize; 3] { |
24 | 25 | // OK, same as above but written differently.
|
25 | 26 | }
|
26 | 27 |
|
27 |
| -impl<T,U> Foo<T> for U { |
| 28 | +impl<T, U> Foo<T> for U { |
28 | 29 | //~^ ERROR conflicting implementations of trait `Foo<_>` for type `[isize; 0]`
|
29 | 30 | }
|
30 | 31 |
|
31 |
| -impl<T,U> Bar for T { |
| 32 | +impl<T, U> Bar for T { |
32 | 33 | //~^ ERROR the type parameter `U` is not constrained
|
33 | 34 |
|
34 | 35 | type Out = U;
|
35 | 36 |
|
36 | 37 | // Using `U` in an associated type within the impl is not good enough!
|
37 | 38 | }
|
38 | 39 |
|
39 |
| -impl<T,U> Bar for T |
40 |
| - where T : Bar<Out=U> |
| 40 | +impl<T, U> Bar for T |
| 41 | +where |
| 42 | + T: Bar<Out = U>, |
41 | 43 | {
|
42 |
| - //~^^^ ERROR the type parameter `U` is not constrained |
43 |
| - |
| 44 | + //~^^^^ ERROR the type parameter `U` is not constrained by the impl trait, self type, or predicates |
| 45 | + //~| ERROR conflicting implementations of trait `Bar` |
44 | 46 | // This crafty self-referential attempt is still no good.
|
45 | 47 | }
|
46 | 48 |
|
47 |
| -impl<T,U,V> Foo<T> for T |
48 |
| - where (T,U): Bar<Out=V> |
| 49 | +impl<T, U, V> Foo<T> for T |
| 50 | +where |
| 51 | + (T, U): Bar<Out = V>, |
49 | 52 | {
|
50 |
| - //~^^^ ERROR the type parameter `U` is not constrained |
51 |
| - //~| ERROR the type parameter `V` is not constrained |
| 53 | + //~^^^^ ERROR the type parameter `U` is not constrained |
| 54 | + //~| ERROR the type parameter `V` is not constrained |
| 55 | + //~| ERROR conflicting implementations of trait `Foo<[isize; 0]>` for type `[isize; 0]` |
52 | 56 |
|
53 | 57 | // Here, `V` is bound by an output type parameter, but the inputs
|
54 | 58 | // are not themselves constrained.
|
55 | 59 | }
|
56 | 60 |
|
57 |
| -impl<T,U,V> Foo<(T,U)> for T |
58 |
| - where (T,U): Bar<Out=V> |
| 61 | +impl<T, U, V> Foo<(T, U)> for T |
| 62 | +where |
| 63 | + (T, U): Bar<Out = V>, |
59 | 64 | {
|
| 65 | + //~^^^^ ERROR conflicting implementations of trait `Foo<([isize; 0], _)>` for type `[isize; 0]` |
60 | 66 | // As above, but both T and U ARE constrained.
|
61 | 67 | }
|
62 | 68 |
|
63 |
| -fn main() { } |
| 69 | +fn main() {} |
0 commit comments