]> git.proxmox.com Git - rustc.git/blob - src/test/parse-fail/range_inclusive_gate.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / parse-fail / range_inclusive_gate.rs
1 // Copyright 2016 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 // Make sure that #![feature(inclusive_range_syntax)] is required.
12
13 // #![feature(inclusive_range_syntax, inclusive_range)]
14
15 macro_rules! m {
16 () => { for _ in 1...10 {} } //~ ERROR inclusive range syntax is experimental
17 }
18
19 #[cfg(nope)]
20 fn f() {}
21 #[cfg(not(nope))]
22 fn f() {
23 for _ in 1...10 {} //~ ERROR inclusive range syntax is experimental
24 }
25
26 #[cfg(nope)]
27 macro_rules! n { () => {} }
28 #[cfg(not(nope))]
29 macro_rules! n {
30 () => { for _ in 1...10 {} } //~ ERROR inclusive range syntax is experimental
31 }
32
33 macro_rules! o {
34 () => {{
35 #[cfg(nope)]
36 fn g() {}
37 #[cfg(not(nope))]
38 fn g() {
39 for _ in 1...10 {} //~ ERROR inclusive range syntax is experimental
40 }
41
42 g();
43 }}
44 }
45
46 #[cfg(nope)]
47 macro_rules! p { () => {} }
48 #[cfg(not(nope))]
49 macro_rules! p {
50 () => {{
51 #[cfg(nope)]
52 fn h() {}
53 #[cfg(not(nope))]
54 fn h() {
55 for _ in 1...10 {} //~ ERROR inclusive range syntax is experimental
56 }
57
58 h();
59 }}
60 }
61
62 pub fn main() {
63 for _ in 1...10 {} //~ ERROR inclusive range syntax is experimental
64 for _ in ...10 {} //~ ERROR inclusive range syntax is experimental
65
66 f(); // not allowed in cfg'ed functions
67
68 m!(); // not allowed in macros
69 n!(); // not allowed in cfg'ed macros
70 o!(); // not allowed in macros that output cfgs
71 p!(); // not allowed in cfg'ed macros that output cfgs
72 }
73
74