]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/abridged.stderr
Auto merge of #76110 - FedericoPonzi:convert-openoptions-cint, r=JoshTriplett
[rust.git] / src / test / ui / mismatched_types / abridged.stderr
1 error[E0308]: mismatched types
2   --> $DIR/abridged.rs:16:5
3    |
4 LL | fn a() -> Foo {
5    |           --- expected `Foo` because of return type
6 LL |     Some(Foo { bar: 1 })
7    |     ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Option`
8    |
9    = note: expected struct `Foo`
10                 found enum `Option<Foo>`
11
12 error[E0308]: mismatched types
13   --> $DIR/abridged.rs:20:5
14    |
15 LL | fn a2() -> Foo {
16    |            --- expected `Foo` because of return type
17 LL |     Ok(Foo { bar: 1})
18    |     ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::result::Result`
19    |
20    = note: expected struct `Foo`
21                 found enum `std::result::Result<Foo, _>`
22
23 error[E0308]: mismatched types
24   --> $DIR/abridged.rs:24:5
25    |
26 LL | fn b() -> Option<Foo> {
27    |           ----------- expected `Option<Foo>` because of return type
28 LL |     Foo { bar: 1 }
29    |     ^^^^^^^^^^^^^^
30    |     |
31    |     expected enum `Option`, found struct `Foo`
32    |     help: try using a variant of the expected enum: `Some(Foo { bar: 1 })`
33    |
34    = note: expected enum `Option<Foo>`
35             found struct `Foo`
36
37 error[E0308]: mismatched types
38   --> $DIR/abridged.rs:28:5
39    |
40 LL | fn c() -> Result<Foo, Bar> {
41    |           ---------------- expected `std::result::Result<Foo, Bar>` because of return type
42 LL |     Foo { bar: 1 }
43    |     ^^^^^^^^^^^^^^
44    |     |
45    |     expected enum `std::result::Result`, found struct `Foo`
46    |     help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })`
47    |
48    = note: expected enum `std::result::Result<Foo, Bar>`
49             found struct `Foo`
50
51 error[E0308]: mismatched types
52   --> $DIR/abridged.rs:39:5
53    |
54 LL | fn d() -> X<X<String, String>, String> {
55    |           ---------------------------- expected `X<X<String, String>, String>` because of return type
56 ...
57 LL |     x
58    |     ^ expected struct `String`, found integer
59    |
60    = note: expected struct `X<X<_, String>, String>`
61               found struct `X<X<_, {integer}>, {integer}>`
62
63 error[E0308]: mismatched types
64   --> $DIR/abridged.rs:50:5
65    |
66 LL | fn e() -> X<X<String, String>, String> {
67    |           ---------------------------- expected `X<X<String, String>, String>` because of return type
68 ...
69 LL |     x
70    |     ^ expected struct `String`, found integer
71    |
72    = note: expected struct `X<X<_, String>, _>`
73               found struct `X<X<_, {integer}>, _>`
74
75 error[E0308]: mismatched types
76   --> $DIR/abridged.rs:54:5
77    |
78 LL | fn f() -> String {
79    |           ------ expected `String` because of return type
80 LL |     1+2
81    |     ^^^
82    |     |
83    |     expected struct `String`, found integer
84    |     help: try using a conversion method: `(1+2).to_string()`
85
86 error[E0308]: mismatched types
87   --> $DIR/abridged.rs:59:5
88    |
89 LL | fn g() -> String {
90    |           ------ expected `String` because of return type
91 LL |     -2
92    |     ^^
93    |     |
94    |     expected struct `String`, found integer
95    |     help: try using a conversion method: `(-2).to_string()`
96
97 error: aborting due to 8 previous errors
98
99 For more information about this error, try `rustc --explain E0308`.