about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-12-21 00:04:13 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-12-21 09:27:34 -0800
commiteb47e1e4469fc23cf4fdce7aebdfd59d9b012064 (patch)
treeea91669277cd15f97c3e482cb46c8ad10097034c /src/test
parentcfc815bef4b7fec0f77255188b582b4b7b5e73ca (diff)
parent314ed2df096858e7c174254b0babd5f949ae6d27 (diff)
downloadrust-eb47e1e4469fc23cf4fdce7aebdfd59d9b012064.tar.gz
rust-eb47e1e4469fc23cf4fdce7aebdfd59d9b012064.zip
rollup merge of #20039: barosl/if-let-friendly-error
Fixes #19991.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-19991.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-19991.rs b/src/test/compile-fail/issue-19991.rs
new file mode 100644
index 00000000000..0f1dbfa3492
--- /dev/null
+++ b/src/test/compile-fail/issue-19991.rs
@@ -0,0 +1,18 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test if the sugared if-let construct correctly prints "missing an else clause" when an else
+// clause does not exist, instead of the unsympathetic "match arms have incompatible types"
+
+fn main() {
+    if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause: expected `()`
+        765i32
+    };
+}