about summary refs log tree commit diff
path: root/src/test/compile-fail/dead-code-closure-bang.rs
diff options
context:
space:
mode:
authorP1start <rewi-github@whanau.org>2014-08-30 20:37:11 +1200
committerP1start <rewi-github@whanau.org>2014-09-03 15:21:09 +1200
commite5bbbbe274dff5d420f256b58ff107e619ddf86d (patch)
treee5eac083f97d4b3a0488a8046739abd10c0fcccf /src/test/compile-fail/dead-code-closure-bang.rs
parentb220db03bd334b2e74c4dfd62ed1318941b82a3c (diff)
downloadrust-e5bbbbe274dff5d420f256b58ff107e619ddf86d.tar.gz
rust-e5bbbbe274dff5d420f256b58ff107e619ddf86d.zip
Add some tests for closures that return `!`
Diffstat (limited to 'src/test/compile-fail/dead-code-closure-bang.rs')
-rw-r--r--src/test/compile-fail/dead-code-closure-bang.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/compile-fail/dead-code-closure-bang.rs b/src/test/compile-fail/dead-code-closure-bang.rs
new file mode 100644
index 00000000000..96e8378a35d
--- /dev/null
+++ b/src/test/compile-fail/dead-code-closure-bang.rs
@@ -0,0 +1,17 @@
+// 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.
+
+#![deny(unreachable_code)]
+
+fn main() {
+    let x: || -> ! = || fail!();
+    x();
+    println!("Foo bar"); //~ ERROR: unreachable statement
+}