summaryrefslogtreecommitdiffstats
path: root/tests/ui/did_you_mean/compatible-variants.stderr
blob: fe81da19833a7e2baba18c922b3c834d8578aea6 (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:13:5
   |
LL |   fn a() -> Option<()> {
   |             ---------- expected `Option<()>` because of return type
LL | /     while false {
LL | |
LL | |         f();
LL | |     }
   | |_____^ expected enum `Option`, found `()`
   |
   = note:   expected enum `Option<()>`
           found unit type `()`
help: try adding an expression at the end of the block
   |
LL ~     }
LL +     None
   |
LL ~     }
LL +     Some(())
   |

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:21:5
   |
LL | fn b() -> Result<(), ()> {
   |           -------------- expected `Result<(), ()>` because of return type
LL |     f()
   |     ^^^ expected enum `Result`, found `()`
   |
   = note:   expected enum `Result<(), ()>`
           found unit type `()`
help: try adding an expression at the end of the block
   |
LL ~     f();
LL +     Ok(())
   |

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:27:5
   |
LL |   fn c() -> Option<()> {
   |             ---------- expected `Option<()>` because of return type
LL | /     for _ in [1, 2] {
LL | |
LL | |         f();
LL | |     }
   | |_____^ expected enum `Option`, found `()`
   |
   = note:   expected enum `Option<()>`
           found unit type `()`
help: try adding an expression at the end of the block
   |
LL ~     }
LL +     None
   |
LL ~     }
LL +     Some(())
   |

error[E0308]: `?` operator has incompatible types
  --> $DIR/compatible-variants.rs:35:5
   |
LL |     c()?
   |     ^^^^ expected enum `Option`, found `()`
   |
   = note: `?` operator cannot convert from `()` to `Option<()>`
   = note:   expected enum `Option<()>`
           found unit type `()`
help: try removing this `?`
   |
LL -     c()?
LL +     c()
   |
help: try adding an expression at the end of the block
   |
LL ~     c()?;
LL +     None
   |
LL ~     c()?;
LL +     Some(())
   |

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:42:25
   |
LL |     let _: Option<()> = while false {};
   |            ----------   ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
   |            |
   |            expected due to this
   |
   = note:   expected enum `Option<()>`
           found unit type `()`
help: try wrapping the expression in `Some`
   |
LL |     let _: Option<()> = Some(while false {});
   |                         +++++              +

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:46:9
   |
LL |         while false {}
   |         ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
   |
   = note:   expected enum `Option<()>`
           found unit type `()`
help: try adding an expression at the end of the block
   |
LL ~         while false {}
LL +         None
   |
LL ~         while false {}
LL +         Some(())
   |

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:50:31
   |
LL |     let _: Result<i32, i32> = 1;
   |            ----------------   ^ expected enum `Result`, found integer
   |            |
   |            expected due to this
   |
   = note: expected enum `Result<i32, i32>`
              found type `{integer}`
help: try wrapping the expression in a variant of `Result`
   |
LL |     let _: Result<i32, i32> = Ok(1);
   |                               +++ +
LL |     let _: Result<i32, i32> = Err(1);
   |                               ++++ +

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:53:26
   |
LL |     let _: Option<i32> = 1;
   |            -----------   ^ expected enum `Option`, found integer
   |            |
   |            expected due to this
   |
   = note: expected enum `Option<i32>`
              found type `{integer}`
help: try wrapping the expression in `Some`
   |
LL |     let _: Option<i32> = Some(1);
   |                          +++++ +

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:56:28
   |
LL |     let _: Hey<i32, i32> = 1;
   |            -------------   ^ expected enum `Hey`, found integer
   |            |
   |            expected due to this
   |
   = note: expected enum `Hey<i32, i32>`
              found type `{integer}`
help: try wrapping the expression in a variant of `Hey`
   |
LL |     let _: Hey<i32, i32> = Hey::A(1);
   |                            +++++++ +
LL |     let _: Hey<i32, i32> = Hey::B(1);
   |                            +++++++ +

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:59:29
   |
LL |     let _: Hey<i32, bool> = false;
   |            --------------   ^^^^^ expected enum `Hey`, found `bool`
   |            |
   |            expected due to this
   |
   = note: expected enum `Hey<i32, bool>`
              found type `bool`
help: try wrapping the expression in `Hey::B`
   |
LL |     let _: Hey<i32, bool> = Hey::B(false);
   |                             +++++++     +

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:63:19
   |
LL |     let _ = Foo { bar };
   |                   ^^^ expected enum `Option`, found `i32`
   |
   = note: expected enum `Option<i32>`
              found type `i32`
help: try wrapping the expression in `Some`
   |
LL |     let _ = Foo { bar: Some(bar) };
   |                   ++++++++++   +

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:80:16
   |
LL |     let a: A = B::Fst;
   |            -   ^^^^^^ expected enum `A`, found enum `B`
   |            |
   |            expected due to this
   |
help: try wrapping the expression in `A::B`
   |
LL |     let a: A = A::B { b: B::Fst };
   |                +++++++++        +

error[E0308]: mismatched types
  --> $DIR/compatible-variants.rs:86:17
   |
LL |     let a: A2 = B::Fst;
   |            --   ^^^^^^ expected struct `A2`, found enum `B`
   |            |
   |            expected due to this
   |
help: try wrapping the expression in `A2`
   |
LL |     let a: A2 = A2(B::Fst);
   |                 +++      +

error: aborting due to 13 previous errors

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