1 error[E0308]: mismatched types
2 --> $DIR/coerce-result-return-value-2.rs:8:17
4 LL | fn foo4(x: Result<(), A>) -> Result<(), B> {
5 | ------------- expected `Result<(), B>` because of return type
8 | ^ expected struct `B`, found struct `A`
10 = note: expected enum `Result<_, B>`
11 found enum `Result<_, A>`
12 help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result`
17 error[E0308]: mismatched types
18 --> $DIR/coerce-result-return-value-2.rs:14:24
20 LL | fn foo5(x: Result<(), A>) -> Result<(), B> {
21 | ------------- expected `Result<(), B>` because of return type
23 LL | true => return x,
24 | ^ expected struct `B`, found struct `A`
26 = note: expected enum `Result<_, B>`
27 found enum `Result<_, A>`
28 help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result`
30 LL | true => return Ok(x?),
33 error[E0308]: mismatched types
34 --> $DIR/coerce-result-return-value-2.rs:21:28
36 LL | let _: Result<(), B> = {
37 | ____________________________^
40 | |_____^ expected enum `Result`, found `()`
42 = note: expected enum `Result<(), B>`
45 error: aborting due to 3 previous errors
47 For more information about this error, try `rustc --explain E0308`.