Add test for #24889

Fixes #24889.
r? @Mark-Simulacrum.
This commit is contained in:
Malo Jaffré 2017-06-18 14:30:33 +02:00
parent 78d8416caf
commit a5403d09f5
2 changed files with 21 additions and 0 deletions

View File

@ -14,6 +14,10 @@ fn plus_one(x: i32) -> i32 {
x + 1;
}
fn foo() -> Result<u8, u64> {
Ok(1);
}
fn main() {
let x = plus_one(5);
println!("X = {}", x);

View File

@ -15,5 +15,22 @@ help: consider removing this semicolon:
14 | x + 1;
| ^
error[E0308]: mismatched types
--> $DIR/coercion-missing-tail-expected-type.rs:17:29
|
17 | fn foo() -> Result<u8, u64> {
| _____________________________^
18 | | Ok(1);
19 | | }
| |_^ expected enum `std::result::Result`, found ()
|
= note: expected type `std::result::Result<u8, u64>`
found type `()`
help: consider removing this semicolon:
--> $DIR/coercion-missing-tail-expected-type.rs:18:10
|
18 | Ok(1);
| ^
error: aborting due to previous error(s)