]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // This test checks that genuine type errors with partial |
2 | // type hints are understandable. | |
223e47cc | 3 | |
85aaf69f SL |
4 | use std::marker::PhantomData; |
5 | ||
6 | struct Foo<T>(PhantomData<T>); | |
7 | struct Bar<U>(PhantomData<U>); | |
223e47cc | 8 | |
1a4d82fc JJ |
9 | pub fn main() { |
10 | } | |
223e47cc | 11 | |
1a4d82fc | 12 | fn test1() { |
85aaf69f SL |
13 | let x: Foo<_> = Bar::<usize>(PhantomData); |
14 | //~^ ERROR mismatched types | |
60c5eb7d XL |
15 | //~| expected struct `Foo<_>` |
16 | //~| found struct `Bar<usize>` | |
a7813a04 | 17 | //~| expected struct `Foo`, found struct `Bar` |
1a4d82fc JJ |
18 | let y: Foo<usize> = x; |
19 | } | |
223e47cc | 20 | |
1a4d82fc | 21 | fn test2() { |
85aaf69f SL |
22 | let x: Foo<_> = Bar::<usize>(PhantomData); |
23 | //~^ ERROR mismatched types | |
60c5eb7d XL |
24 | //~| expected struct `Foo<_>` |
25 | //~| found struct `Bar<usize>` | |
a7813a04 | 26 | //~| expected struct `Foo`, found struct `Bar` |
223e47cc | 27 | } |