]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/issue-27042.rs
23afa4b629636ac94e3e856b736d840466b9cba8
[rust.git] / src / test / compile-fail / issue-27042.rs
1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Regression test for #27042. Test that a loop's label is included in its span.
12
13 fn main() {
14     let _: i32 =
15         'a: // in this case, the citation is just the `break`:
16         loop { break }; //~ ERROR mismatched types
17     let _: i32 =
18         'b: //~ ERROR mismatched types
19         while true { break }; // but here we cite the whole loop
20     let _: i32 =
21         'c: //~ ERROR mismatched types
22         for _ in None { break }; // but here we cite the whole loop
23     let _: i32 =
24         'd: //~ ERROR mismatched types
25         while let Some(_) = None { break };
26 }