summaryrefslogtreecommitdiffstats
path: root/tests/ui/mismatched_types/abridged.stderr
blob: ff1a836c9aec034b7e2cbd5e929b5a190a05b89a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
error[E0308]: mismatched types
  --> $DIR/abridged.rs:16:5
   |
LL | fn a() -> Foo {
   |           --- expected `Foo` because of return type
LL |     Some(Foo { bar: 1 })
   |     ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Option`
   |
   = note: expected struct `Foo`
                found enum `Option<Foo>`

error[E0308]: mismatched types
  --> $DIR/abridged.rs:20:5
   |
LL | fn a2() -> Foo {
   |            --- expected `Foo` because of return type
LL |     Ok(Foo { bar: 1})
   |     ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Result`
   |
   = note: expected struct `Foo`
                found enum `Result<Foo, _>`

error[E0308]: mismatched types
  --> $DIR/abridged.rs:24:5
   |
LL | fn b() -> Option<Foo> {
   |           ----------- expected `Option<Foo>` because of return type
LL |     Foo { bar: 1 }
   |     ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
   |
   = note: expected enum `Option<Foo>`
            found struct `Foo`
help: try wrapping the expression in `Some`
   |
LL |     Some(Foo { bar: 1 })
   |     +++++              +

error[E0308]: mismatched types
  --> $DIR/abridged.rs:28:5
   |
LL | fn c() -> Result<Foo, Bar> {
   |           ---------------- expected `Result<Foo, Bar>` because of return type
LL |     Foo { bar: 1 }
   |     ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
   |
   = note: expected enum `Result<Foo, Bar>`
            found struct `Foo`
help: try wrapping the expression in `Ok`
   |
LL |     Ok(Foo { bar: 1 })
   |     +++              +

error[E0308]: mismatched types
  --> $DIR/abridged.rs:39:5
   |
LL | fn d() -> X<X<String, String>, String> {
   |           ---------------------------- expected `X<X<String, String>, String>` because of return type
...
LL |     x
   |     ^ expected struct `String`, found integer
   |
   = note: expected struct `X<X<_, String>, String>`
              found struct `X<X<_, {integer}>, {integer}>`

error[E0308]: mismatched types
  --> $DIR/abridged.rs:50:5
   |
LL | fn e() -> X<X<String, String>, String> {
   |           ---------------------------- expected `X<X<String, String>, String>` because of return type
...
LL |     x
   |     ^ expected struct `String`, found integer
   |
   = note: expected struct `X<X<_, String>, _>`
              found struct `X<X<_, {integer}>, _>`

error[E0308]: mismatched types
  --> $DIR/abridged.rs:54:5
   |
LL | fn f() -> String {
   |           ------ expected `String` because of return type
LL |     1+2
   |     ^^^ expected struct `String`, found integer
   |
help: try using a conversion method
   |
LL |     (1+2).to_string()
   |     +   +++++++++++++

error[E0308]: mismatched types
  --> $DIR/abridged.rs:59:5
   |
LL | fn g() -> String {
   |           ------ expected `String` because of return type
LL |     -2
   |     ^^ expected struct `String`, found integer
   |
help: try using a conversion method
   |
LL |     (-2).to_string()
   |     +  +++++++++++++

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0308`.