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 `Foo`, found `Option` | = note: expected struct `Foo` found enum `Option` 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 `Foo`, found `Result` | = note: expected struct `Foo` found enum `Result` error[E0308]: mismatched types --> $DIR/abridged.rs:24:5 | LL | fn b() -> Option { | ----------- expected `Option` because of return type LL | Foo { bar: 1 } | ^^^^^^^^^^^^^^ expected `Option`, found `Foo` | = note: expected enum `Option` 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 { | ---------------- expected `Result` because of return type LL | Foo { bar: 1 } | ^^^^^^^^^^^^^^ expected `Result`, found `Foo` | = note: expected enum `Result` 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, String> { | ---------------------------- expected `X, String>` because of return type ... LL | x | ^ expected `X, String>`, found `X, {integer}>` | = note: expected struct `X, String>` found struct `X, {integer}>` error[E0308]: mismatched types --> $DIR/abridged.rs:50:5 | LL | fn e() -> X, String> { | ---------------------------- expected `X, String>` because of return type ... LL | x | ^ expected `X, String>`, found `X, String>` | = note: expected struct `X, _>` found struct `X, _>` error[E0308]: mismatched types --> $DIR/abridged.rs:54:5 | LL | fn f() -> String { | ------ expected `String` because of return type LL | 1+2 | ^^^ expected `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 `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`.