Skip to content

Commit

Permalink
Add test for #24889
Browse files Browse the repository at this point in the history
  • Loading branch information
MaloJaffre committed Jun 18, 2017
1 parent 78d8416 commit a5403d0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/test/ui/coercion-missing-tail-expected-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 17 additions & 0 deletions src/test/ui/coercion-missing-tail-expected-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit a5403d0

Please sign in to comment.