]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-69306.rs
point at private fields in struct literal
[rust.git] / src / test / ui / issues / issue-69306.rs
1 fn main() {}
2
3 struct S0<T>(T);
4 impl<T> S0<T> {
5     const C: S0<u8> = Self(0);
6     //~^ ERROR mismatched types
7     //~| ERROR mismatched types
8
9     fn foo() {
10         Self(0);
11         //~^ ERROR mismatched types
12     }
13 }
14
15 // Testing normalization.
16 trait Fun {
17     type Out;
18 }
19 impl<T> Fun for S0<T> {
20     type Out = Self;
21 }
22 trait Foo<T> {
23     fn foo();
24 }
25 impl<T> Foo<T> for <S0<T> as Fun>::Out {
26     fn foo() {
27         Self(0); //~ ERROR mismatched types
28     }
29 }
30
31 struct S1<T, U>(T, U);
32 impl<T> S1<T, u8> {
33     const C: S1<u8, u8> = Self(0, 1);
34     //~^ ERROR mismatched types
35     //~| ERROR mismatched types
36 }
37
38 struct S2<T>(T);
39 impl<T> S2<T> {
40     fn map<U>(x: U) -> S2<U> {
41         Self(x)
42         //~^ ERROR mismatched types
43         //~| ERROR mismatched types
44     }
45 }