1 error[E0308]: mismatched types
2 --> $DIR/abridged.rs:16:5
5 | --- expected `Foo` because of return type
6 LL | Some(Foo { bar: 1 })
7 | ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Option`
9 = note: expected struct `Foo`
10 found enum `Option<Foo>`
12 error[E0308]: mismatched types
13 --> $DIR/abridged.rs:20:5
16 | --- expected `Foo` because of return type
17 LL | Ok(Foo { bar: 1})
18 | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Result`
20 = note: expected struct `Foo`
21 found enum `Result<Foo, _>`
23 error[E0308]: mismatched types
24 --> $DIR/abridged.rs:24:5
26 LL | fn b() -> Option<Foo> {
27 | ----------- expected `Option<Foo>` because of return type
29 | ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
31 = note: expected enum `Option<Foo>`
33 help: try wrapping the expression in `Some`
35 LL | Some(Foo { bar: 1 })
38 error[E0308]: mismatched types
39 --> $DIR/abridged.rs:28:5
41 LL | fn c() -> Result<Foo, Bar> {
42 | ---------------- expected `Result<Foo, Bar>` because of return type
44 | ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
46 = note: expected enum `Result<Foo, Bar>`
48 help: try wrapping the expression in `Ok`
50 LL | Ok(Foo { bar: 1 })
53 error[E0308]: mismatched types
54 --> $DIR/abridged.rs:39:5
56 LL | fn d() -> X<X<String, String>, String> {
57 | ---------------------------- expected `X<X<String, String>, String>` because of return type
60 | ^ expected struct `String`, found integer
62 = note: expected struct `X<X<_, String>, String>`
63 found struct `X<X<_, {integer}>, {integer}>`
65 error[E0308]: mismatched types
66 --> $DIR/abridged.rs:50:5
68 LL | fn e() -> X<X<String, String>, String> {
69 | ---------------------------- expected `X<X<String, String>, String>` because of return type
72 | ^ expected struct `String`, found integer
74 = note: expected struct `X<X<_, String>, _>`
75 found struct `X<X<_, {integer}>, _>`
77 error[E0308]: mismatched types
78 --> $DIR/abridged.rs:54:5
80 LL | fn f() -> String {
81 | ------ expected `String` because of return type
83 | ^^^ expected struct `String`, found integer
85 help: try using a conversion method
87 LL | (1+2).to_string()
90 error[E0308]: mismatched types
91 --> $DIR/abridged.rs:59:5
93 LL | fn g() -> String {
94 | ------ expected `String` because of return type
96 | ^^ expected struct `String`, found integer
98 help: try using a conversion method
100 LL | (-2).to_string()
103 error: aborting due to 8 previous errors
105 For more information about this error, try `rustc --explain E0308`.