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.
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.
11 // compile-flags:--test
13 // This file tests the source-partitioning behavior of rustdoc.
14 // Each test contains some code that should be put into the generated
15 // `fn main` and some attributes should be left outside (except the first
16 // one, which has no attributes).
17 // If the #![recursion_limit] attribute is incorrectly left inside,
18 // then the tests will fail because the macro recurses 128 times.
21 /// assert_eq!(1 + 1, 2);
26 /// #![recursion_limit = "1024"]
27 /// macro_rules! recurse {
29 /// (() $($rest:tt)*) => { recurse!($($rest)*); }
31 /// recurse!(() () () () () () () ()
32 /// () () () () () () () ()
33 /// () () () () () () () ()
34 /// () () () () () () () ()
35 /// () () () () () () () ()
36 /// () () () () () () () ()
37 /// () () () () () () () ()
38 /// () () () () () () () ()
39 /// () () () () () () () ()
40 /// () () () () () () () ()
41 /// () () () () () () () ()
42 /// () () () () () () () ()
43 /// () () () () () () () ()
44 /// () () () () () () () ()
45 /// () () () () () () () ()
46 /// () () () () () () () ());
47 /// assert_eq!(1 + 1, 2);
49 pub fn non_feature_attr() {}
52 /// #![feature(core_intrinsics)]
53 /// assert_eq!(1 + 1, 2);
55 pub fn feature_attr() {}
58 /// #![feature(core_intrinsics)]
59 /// #![recursion_limit = "1024"]
60 /// macro_rules! recurse {
62 /// (() $($rest:tt)*) => { recurse!($($rest)*); }
64 /// recurse!(() () () () () () () ()
65 /// () () () () () () () ()
66 /// () () () () () () () ()
67 /// () () () () () () () ()
68 /// () () () () () () () ()
69 /// () () () () () () () ()
70 /// () () () () () () () ()
71 /// () () () () () () () ()
72 /// () () () () () () () ()
73 /// () () () () () () () ()
74 /// () () () () () () () ()
75 /// () () () () () () () ()
76 /// () () () () () () () ()
77 /// () () () () () () () ()
78 /// () () () () () () () ()
79 /// () () () () () () () ());
80 /// assert_eq!(1 + 1, 2);
82 pub fn both_attrs() {}
85 /// #![recursion_limit = "1024"]
86 /// #![feature(core_intrinsics)]
87 /// macro_rules! recurse {
89 /// (() $($rest:tt)*) => { recurse!($($rest)*); }
91 /// recurse!(() () () () () () () ()
92 /// () () () () () () () ()
93 /// () () () () () () () ()
94 /// () () () () () () () ()
95 /// () () () () () () () ()
96 /// () () () () () () () ()
97 /// () () () () () () () ()
98 /// () () () () () () () ()
99 /// () () () () () () () ()
100 /// () () () () () () () ()
101 /// () () () () () () () ()
102 /// () () () () () () () ()
103 /// () () () () () () () ()
104 /// () () () () () () () ()
105 /// () () () () () () () ()
106 /// () () () () () () () ());
107 /// assert_eq!(1 + 1, 2);
109 pub fn both_attrs_reverse() {}