about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-07-20 00:13:22 +0000
committerbors <bors@rust-lang.org>2015-07-20 00:13:22 +0000
commitbe23d44a539deff16170d2af8fa10fb1cecc6a01 (patch)
tree22a15b24c6d3d22b0877788336079f8c15d25ffa /src/test
parent5d304134ff65931e0529bf68ec14972f81d2fdb1 (diff)
parent12963606d015c5f68c6e8bc51267cd2b9c8d0cfe (diff)
downloadrust-be23d44a539deff16170d2af8fa10fb1cecc6a01.tar.gz
rust-be23d44a539deff16170d2af8fa10fb1cecc6a01.zip
Auto merge of #27065 - marcusklaas:loop-label, r=nrc
This closes https://github.com/rust-lang/rust/issues/27042.

I'd love to know if there's a way to make a regression test for this!
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-27042.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-27042.rs b/src/test/compile-fail/issue-27042.rs
new file mode 100644
index 00000000000..f31389f1337
--- /dev/null
+++ b/src/test/compile-fail/issue-27042.rs
@@ -0,0 +1,26 @@
+// Copyright 2012-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.
+
+// Regression test for #27042. Test that a loop's label is included in its span.
+
+fn main() {
+    let _: i32 =
+        'a: //~ ERROR mismatched types
+        loop { break };
+    let _: i32 =
+        'b: //~ ERROR mismatched types
+        while true { break };
+    let _: i32 =
+        'c: //~ ERROR mismatched types
+        for _ in None { break };
+    let _: i32 =
+        'd: //~ ERROR mismatched types
+        while let Some(_) = None { break };
+}