]> git.lizzy.rs Git - rust.git/blob - tests/ui/mismatched_types/abridged.stderr
Auto merge of #106627 - Ezrashaw:no-e0711-without-staged-api, r=Mark-Simulacrum
[rust.git] / tests / 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 `Result`
19    |
20    = note: expected struct `Foo`
21                 found enum `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    |     ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
30    |
31    = note: expected enum `Option<Foo>`
32             found struct `Foo`
33 help: try wrapping the expression in `Some`
34    |
35 LL |     Some(Foo { bar: 1 })
36    |     +++++              +
37
38 error[E0308]: mismatched types
39   --> $DIR/abridged.rs:28:5
40    |
41 LL | fn c() -> Result<Foo, Bar> {
42    |           ---------------- expected `Result<Foo, Bar>` because of return type
43 LL |     Foo { bar: 1 }
44    |     ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
45    |
46    = note: expected enum `Result<Foo, Bar>`
47             found struct `Foo`
48 help: try wrapping the expression in `Ok`
49    |
50 LL |     Ok(Foo { bar: 1 })
51    |     +++              +
52
53 error[E0308]: mismatched types
54   --> $DIR/abridged.rs:39:5
55    |
56 LL | fn d() -> X<X<String, String>, String> {
57    |           ---------------------------- expected `X<X<String, String>, String>` because of return type
58 ...
59 LL |     x
60    |     ^ expected struct `String`, found integer
61    |
62    = note: expected struct `X<X<_, String>, String>`
63               found struct `X<X<_, {integer}>, {integer}>`
64
65 error[E0308]: mismatched types
66   --> $DIR/abridged.rs:50:5
67    |
68 LL | fn e() -> X<X<String, String>, String> {
69    |           ---------------------------- expected `X<X<String, String>, String>` because of return type
70 ...
71 LL |     x
72    |     ^ expected struct `String`, found integer
73    |
74    = note: expected struct `X<X<_, String>, _>`
75               found struct `X<X<_, {integer}>, _>`
76
77 error[E0308]: mismatched types
78   --> $DIR/abridged.rs:54:5
79    |
80 LL | fn f() -> String {
81    |           ------ expected `String` because of return type
82 LL |     1+2
83    |     ^^^ expected struct `String`, found integer
84    |
85 help: try using a conversion method
86    |
87 LL |     (1+2).to_string()
88    |     +   +++++++++++++
89
90 error[E0308]: mismatched types
91   --> $DIR/abridged.rs:59:5
92    |
93 LL | fn g() -> String {
94    |           ------ expected `String` because of return type
95 LL |     -2
96    |     ^^ expected struct `String`, found integer
97    |
98 help: try using a conversion method
99    |
100 LL |     (-2).to_string()
101    |     +  +++++++++++++
102
103 error: aborting due to 8 previous errors
104
105 For more information about this error, try `rustc --explain E0308`.