]> git.lizzy.rs Git - rust.git/commitdiff
Add test for #24889
authorMalo Jaffré <jaffre.malo@gmail.com>
Sun, 18 Jun 2017 12:30:33 +0000 (14:30 +0200)
committerMalo Jaffré <jaffre.malo@gmail.com>
Sun, 18 Jun 2017 12:30:33 +0000 (14:30 +0200)
Fixes #24889.
r? @Mark-Simulacrum.

src/test/ui/coercion-missing-tail-expected-type.rs
src/test/ui/coercion-missing-tail-expected-type.stderr

index 489ad817ea8b1e0a957fefb23029be0133393a5c..15ce79a054f26c2a33a91275309daac3f3437952 100644 (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);
index 28a99e58eca89d954f8aedb62625a15eb96ea9ac..e96bc425e0b45fad9e2732758f5160d7cabec188 100644 (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)