From a5403d09f5fedd4cdc263e8108e7b455931f74da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20Jaffr=C3=A9?= Date: Sun, 18 Jun 2017 14:30:33 +0200 Subject: [PATCH] Add test for #24889 Fixes #24889. r? @Mark-Simulacrum. --- .../ui/coercion-missing-tail-expected-type.rs | 4 ++++ .../coercion-missing-tail-expected-type.stderr | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/test/ui/coercion-missing-tail-expected-type.rs b/src/test/ui/coercion-missing-tail-expected-type.rs index 489ad817ea8b1..15ce79a054f26 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 { + 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 28a99e58eca89..e96bc425e0b45 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 { + | _____________________________^ +18 | | Ok(1); +19 | | } + | |_^ expected enum `std::result::Result`, found () + | + = note: expected type `std::result::Result` + 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)