rust/tests/ui/type/type-check/issue-116967-cannot-coerce-...

16 lines
548 B
Plaintext

error[E0308]: mismatched types
--> $DIR/issue-116967-cannot-coerce-returned-result.rs:3:5
|
LL | fn foo() -> Result<String, ()> {
| ------------------ expected `Result<String, ()>` because of return type
LL | let out: Result<(), ()> = Ok(());
LL | out
| ^^^ expected `Result<String, ()>`, found `Result<(), ()>`
|
= note: expected enum `Result<String, _>`
found enum `Result<(), _>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.