diff options
| author | Malo Jaffré <jaffre.malo@gmail.com> | 2017-06-18 14:30:33 +0200 |
|---|---|---|
| committer | Malo Jaffré <jaffre.malo@gmail.com> | 2017-06-18 14:30:33 +0200 |
| commit | a5403d09f5fedd4cdc263e8108e7b455931f74da (patch) | |
| tree | a29d61c140302190202494418382b1104f867acd /src | |
| parent | 78d8416caf65cfb50de61bb9423e9efa026bd45a (diff) | |
| download | rust-a5403d09f5fedd4cdc263e8108e7b455931f74da.tar.gz rust-a5403d09f5fedd4cdc263e8108e7b455931f74da.zip | |
Add test for #24889
Fixes #24889. r? @Mark-Simulacrum.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/coercion-missing-tail-expected-type.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/coercion-missing-tail-expected-type.stderr | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/coercion-missing-tail-expected-type.rs b/src/test/ui/coercion-missing-tail-expected-type.rs index 489ad817ea8..15ce79a054f 100644 --- a/src/test/ui/coercion-missing-tail-expected-type.rs +++ b/src/test/ui/coercion-missing-tail-expected-type.rs @@ -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); diff --git a/src/test/ui/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion-missing-tail-expected-type.stderr index 28a99e58eca..e96bc425e0b 100644 --- a/src/test/ui/coercion-missing-tail-expected-type.stderr +++ b/src/test/ui/coercion-missing-tail-expected-type.stderr @@ -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) |
