You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
238
+
|
239
+
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
240
+
= note: if all the returned values were of the same type you could use `impl std::fmt::Display` as the return type
241
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
242
+
= note: you can create a new `enum` with a variant for each returned type
243
+
help: return a boxed trait object instead
244
+
|
245
+
LL | fn hat() -> Box<dyn std::fmt::Display> {
246
+
LL | match 13 {
247
+
LL | 0 => {
248
+
LL | return Box::new(0i32);
249
+
LL | }
250
+
LL | _ => {
251
+
...
252
+
253
+
error[E0308]: `match` arms have incompatible types
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
270
+
|
271
+
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
272
+
= note: if all the returned values were of the same type you could use `impl std::fmt::Display` as the return type
273
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
274
+
= note: you can create a new `enum` with a variant for each returned type
275
+
help: return a boxed trait object instead
276
+
|
277
+
LL | fn pug() -> Box<dyn std::fmt::Display> {
278
+
LL | match 13 {
279
+
LL | 0 => Box::new(0i32),
280
+
LL | 1 => Box::new(1u32),
281
+
LL | _ => Box::new(2u32),
282
+
|
283
+
284
+
error[E0308]: `if` and `else` have incompatible types
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
301
+
|
302
+
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
303
+
= note: if all the returned values were of the same type you could use `impl std::fmt::Display` as the return type
304
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
305
+
= note: you can create a new `enum` with a variant for each returned type
306
+
help: return a boxed trait object instead
307
+
|
308
+
LL | fn man() -> Box<dyn std::fmt::Display> {
309
+
LL | if false {
310
+
LL | Box::new(0i32)
311
+
LL | } else {
312
+
LL | Box::new(1u32)
313
+
|
314
+
315
+
error: aborting due to 14 previous errors
211
316
212
-
For more information about this error, try `rustc --explain E0308`.
317
+
Some errors have detailed explanations: E0308, E0746.
318
+
For more information about an error, try `rustc --explain E0308`.
0 commit comments