| error[E0308]: mismatched types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:5:5 |
| | |
| LL | fn foo() -> impl std::fmt::Display { |
| | ---------------------- expected `i32` because of return type |
| ... |
| LL | 1u32 |
| | ^^^^ expected `i32`, found `u32` |
| | |
| help: change the type of the numeric literal from `u32` to `i32` |
| | |
| LL | 1i32 |
| | ~~~ |
| |
| error[E0308]: mismatched types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:12:16 |
| | |
| LL | fn bar() -> impl std::fmt::Display { |
| | ---------------------- expected `i32` because of return type |
| ... |
| LL | return 1u32; |
| | ^^^^ expected `i32`, found `u32` |
| | |
| help: change the type of the numeric literal from `u32` to `i32` |
| | |
| LL | return 1i32; |
| | ~~~ |
| |
| error[E0308]: mismatched types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:20:9 |
| | |
| LL | fn baz() -> impl std::fmt::Display { |
| | ---------------------- expected `i32` because of return type |
| ... |
| LL | 1u32 |
| | ^^^^ expected `i32`, found `u32` |
| | |
| help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit |
| | |
| LL | }.try_into().unwrap() |
| | ++++++++++++++++++++ |
| |
| error[E0308]: `if` and `else` have incompatible types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:28:9 |
| | |
| LL | / if false { |
| LL | | 0i32 |
| | | ---- expected because of this |
| LL | | } else { |
| LL | | 1u32 |
| | | ^^^^ expected `i32`, found `u32` |
| LL | | } |
| | |_____- `if` and `else` have incompatible types |
| | |
| help: you could change the return type to be a boxed trait object |
| | |
| LL | fn qux() -> Box<dyn std::fmt::Display> { |
| | ~~~~~~~ + |
| help: if you change the return type to expect trait objects, box the returned expressions |
| | |
| LL ~ Box::new(0i32) |
| LL | } else { |
| LL ~ Box::new(1u32) |
| | |
| help: change the type of the numeric literal from `u32` to `i32` |
| | |
| LL | 1i32 |
| | ~~~ |
| |
| error[E0308]: mismatched types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:35:14 |
| | |
| LL | fn bat() -> impl std::fmt::Display { |
| | ---------------------- expected `i32` because of return type |
| ... |
| LL | _ => 1u32, |
| | ^^^^ expected `i32`, found `u32` |
| | |
| help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit |
| | |
| LL | }.try_into().unwrap() |
| | ++++++++++++++++++++ |
| |
| error[E0308]: mismatched types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:40:5 |
| | |
| LL | fn can() -> impl std::fmt::Display { |
| | ---------------------- expected `i32` because of return type |
| LL | / match 13 { |
| LL | | 0 => return 0i32, |
| LL | | 1 => 1u32, |
| LL | | _ => 2u32, |
| LL | | } |
| | |_____^ expected `i32`, found `u32` |
| | |
| help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit |
| | |
| LL | }.try_into().unwrap() |
| | ++++++++++++++++++++ |
| |
| error[E0308]: mismatched types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:53:13 |
| | |
| LL | fn cat() -> impl std::fmt::Display { |
| | ---------------------- expected `i32` because of return type |
| ... |
| LL | 1u32 |
| | ^^^^ expected `i32`, found `u32` |
| | |
| help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit |
| | |
| LL | }.try_into().unwrap() |
| | ++++++++++++++++++++ |
| |
| error[E0308]: `match` arms have incompatible types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:61:14 |
| | |
| LL | / match 13 { |
| LL | | 0 => 0i32, |
| | | ---- this is found to be of type `i32` |
| LL | | 1 => 1u32, |
| | | ^^^^ expected `i32`, found `u32` |
| LL | | _ => 2u32, |
| LL | | } |
| | |_____- `match` arms have incompatible types |
| | |
| help: you could change the return type to be a boxed trait object |
| | |
| LL | fn dog() -> Box<dyn std::fmt::Display> { |
| | ~~~~~~~ + |
| help: if you change the return type to expect trait objects, box the returned expressions |
| | |
| LL ~ 0 => Box::new(0i32), |
| LL ~ 1 => Box::new(1u32), |
| | |
| help: change the type of the numeric literal from `u32` to `i32` |
| | |
| LL | 1 => 1i32, |
| | ~~~ |
| |
| error[E0308]: `if` and `else` have incompatible types |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:97:9 |
| | |
| LL | / if let Some(42) = Some(42) { |
| LL | | 0i32 |
| | | ---- expected because of this |
| LL | | } else { |
| LL | | 1u32 |
| | | ^^^^ expected `i32`, found `u32` |
| LL | | } |
| | |_____- `if` and `else` have incompatible types |
| | |
| help: you could change the return type to be a boxed trait object |
| | |
| LL | fn apt() -> Box<dyn std::fmt::Display> { |
| | ~~~~~~~ + |
| help: if you change the return type to expect trait objects, box the returned expressions |
| | |
| LL ~ Box::new(0i32) |
| LL | } else { |
| LL ~ Box::new(1u32) |
| | |
| help: change the type of the numeric literal from `u32` to `i32` |
| | |
| LL | 1i32 |
| | ~~~ |
| |
| error[E0746]: return type cannot have an unboxed trait object |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:66:13 |
| | |
| LL | fn hat() -> dyn std::fmt::Display { |
| | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time |
| | |
| help: return an `impl Trait` instead of a `dyn Trait`, if all returned values are the same type |
| | |
| LL | fn hat() -> impl std::fmt::Display { |
| | ~~~~ |
| help: box the return type, and wrap all of the returned values in `Box::new` |
| | |
| LL ~ fn hat() -> Box<dyn std::fmt::Display> { |
| LL | match 13 { |
| LL | 0 => { |
| LL ~ return Box::new(0i32); |
| LL | } |
| LL | _ => { |
| LL ~ Box::new(1u32) |
| | |
| |
| error[E0746]: return type cannot have an unboxed trait object |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:77:13 |
| | |
| LL | fn pug() -> dyn std::fmt::Display { |
| | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time |
| | |
| help: return an `impl Trait` instead of a `dyn Trait`, if all returned values are the same type |
| | |
| LL | fn pug() -> impl std::fmt::Display { |
| | ~~~~ |
| help: box the return type, and wrap all of the returned values in `Box::new` |
| | |
| LL ~ fn pug() -> Box<dyn std::fmt::Display> { |
| LL | match 13 { |
| LL ~ 0 => Box::new(0i32), |
| LL ~ 1 => Box::new(1u32), |
| LL ~ _ => Box::new(2u32), |
| | |
| |
| error[E0746]: return type cannot have an unboxed trait object |
| --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:85:13 |
| | |
| LL | fn man() -> dyn std::fmt::Display { |
| | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time |
| | |
| help: return an `impl Trait` instead of a `dyn Trait`, if all returned values are the same type |
| | |
| LL | fn man() -> impl std::fmt::Display { |
| | ~~~~ |
| help: box the return type, and wrap all of the returned values in `Box::new` |
| | |
| LL ~ fn man() -> Box<dyn std::fmt::Display> { |
| LL | if false { |
| LL ~ Box::new(0i32) |
| LL | } else { |
| LL ~ Box::new(1u32) |
| | |
| |
| error: aborting due to 12 previous errors |
| |
| Some errors have detailed explanations: E0308, E0746. |
| For more information about an error, try `rustc --explain E0308`. |