]> git.proxmox.com Git - rustc.git/blame - src/test/ui/typeck/typeck_type_placeholder_mismatch.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / typeck / typeck_type_placeholder_mismatch.rs
CommitLineData
1a4d82fc
JJ
1// This test checks that genuine type errors with partial
2// type hints are understandable.
223e47cc 3
85aaf69f
SL
4use std::marker::PhantomData;
5
6struct Foo<T>(PhantomData<T>);
7struct Bar<U>(PhantomData<U>);
223e47cc 8
1a4d82fc
JJ
9pub fn main() {
10}
223e47cc 11
1a4d82fc 12fn 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 21fn 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}