]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/abridged.rs
Rollup merge of #89945 - JohnTitor:we-now-specialize-clone-from-slice, r=the8472
[rust.git] / src / test / ui / mismatched_types / abridged.rs
1 enum Bar {
2     Qux,
3     Zar,
4 }
5
6 struct Foo {
7     bar: usize,
8 }
9
10 struct X<T1, T2> {
11     x: T1,
12     y: T2,
13 }
14
15 fn a() -> Foo {
16     Some(Foo { bar: 1 }) //~ ERROR mismatched types
17 }
18
19 fn a2() -> Foo {
20     Ok(Foo { bar: 1}) //~ ERROR mismatched types
21 }
22
23 fn b() -> Option<Foo> {
24     Foo { bar: 1 } //~ ERROR mismatched types
25 }
26
27 fn c() -> Result<Foo, Bar> {
28     Foo { bar: 1 } //~ ERROR mismatched types
29 }
30
31 fn d() -> X<X<String, String>, String> {
32     let x = X {
33         x: X {
34             x: "".to_string(),
35             y: 2,
36         },
37         y: 3,
38     };
39     x //~ ERROR mismatched types
40 }
41
42 fn e() -> X<X<String, String>, String> {
43     let x = X {
44         x: X {
45             x: "".to_string(),
46             y: 2,
47         },
48         y: "".to_string(),
49     };
50     x //~ ERROR mismatched types
51 }
52
53 fn f() -> String {
54     1+2 //~ ERROR mismatched types
55 }
56
57
58 fn g() -> String {
59     -2 //~ ERROR mismatched types
60 }
61
62 fn main() {}