about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-08-08 23:28:09 +0800
committerkennytm <kennytm@gmail.com>2017-08-09 00:30:26 +0800
commit3cb23a714f2b7adbf1eee697fb6471c4dd733f04 (patch)
tree46e53a69ca276d053f07ad4ee854ce921993db07 /src/test/compile-fail
parent6d84a355c34fc7dfc1a201478f99890046081398 (diff)
downloadrust-3cb23a714f2b7adbf1eee697fb6471c4dd733f04.tar.gz
rust-3cb23a714f2b7adbf1eee697fb6471c4dd733f04.zip
Type-check `break value;` even outside of `loop {}`.
Fix #43162, fix #43727.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/issue-43162.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-43162.rs b/src/test/compile-fail/issue-43162.rs
new file mode 100644
index 00000000000..8f4661299e9
--- /dev/null
+++ b/src/test/compile-fail/issue-43162.rs
@@ -0,0 +1,17 @@
+// Copyright 2017 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.
+
+fn foo() -> bool {
+    break true; //~ ERROR E0268
+}
+
+fn main() {
+    break {}; //~ ERROR E0268
+}