]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/abridged.stderr
Rollup merge of #89945 - JohnTitor:we-now-specialize-clone-from-slice, r=the8472
[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 `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    |     ^^^^^^^^^^^^^^
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 `Result<Foo, Bar>` because of return type
42 LL |     Foo { bar: 1 }
43    |     ^^^^^^^^^^^^^^
44    |     |
45    |     expected enum `Result`, found struct `Foo`
46    |     help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })`
47    |
48    = note: expected enum `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    |     ^^^ expected struct `String`, found integer
82    |
83 help: try using a conversion method
84    |
85 LL |     (1+2).to_string()
86    |     +   +++++++++++++
87
88 error[E0308]: mismatched types
89   --> $DIR/abridged.rs:59:5
90    |
91 LL | fn g() -> String {
92    |           ------ expected `String` because of return type
93 LL |     -2
94    |     ^^ expected struct `String`, found integer
95    |
96 help: try using a conversion method
97    |
98 LL |     (-2).to_string()
99    |     +  +++++++++++++
100
101 error: aborting due to 8 previous errors
102
103 For more information about this error, try `rustc --explain E0308`.