]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/issue-38129.rs
Rollup merge of #39400 - alexcrichton:arm-cross-test, r=brson
[rust.git] / src / test / rustdoc / issue-38129.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 // compile-flags:--test
12
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.
19
20 /// ```
21 /// assert_eq!(1 + 1, 2);
22 /// ```
23 pub fn simple() {}
24
25 /// ```
26 /// #![recursion_limit = "1024"]
27 /// macro_rules! recurse {
28 ///     (()) => {};
29 ///     (() $($rest:tt)*) => { recurse!($($rest)*); }
30 /// }
31 /// recurse!(() () () () () () () ()
32 ///          () () () () () () () ()
33 ///          () () () () () () () ()
34 ///          () () () () () () () ()
35 ///          () () () () () () () ()
36 ///          () () () () () () () ()
37 ///          () () () () () () () ()
38 ///          () () () () () () () ()
39 ///          () () () () () () () ()
40 ///          () () () () () () () ()
41 ///          () () () () () () () ()
42 ///          () () () () () () () ()
43 ///          () () () () () () () ()
44 ///          () () () () () () () ()
45 ///          () () () () () () () ()
46 ///          () () () () () () () ());
47 /// assert_eq!(1 + 1, 2);
48 /// ```
49 pub fn non_feature_attr() {}
50
51 /// ```
52 /// #![feature(core_intrinsics)]
53 /// assert_eq!(1 + 1, 2);
54 /// ```
55 pub fn feature_attr() {}
56
57 /// ```
58 /// #![feature(core_intrinsics)]
59 /// #![recursion_limit = "1024"]
60 /// macro_rules! recurse {
61 ///     (()) => {};
62 ///     (() $($rest:tt)*) => { recurse!($($rest)*); }
63 /// }
64 /// recurse!(() () () () () () () ()
65 ///          () () () () () () () ()
66 ///          () () () () () () () ()
67 ///          () () () () () () () ()
68 ///          () () () () () () () ()
69 ///          () () () () () () () ()
70 ///          () () () () () () () ()
71 ///          () () () () () () () ()
72 ///          () () () () () () () ()
73 ///          () () () () () () () ()
74 ///          () () () () () () () ()
75 ///          () () () () () () () ()
76 ///          () () () () () () () ()
77 ///          () () () () () () () ()
78 ///          () () () () () () () ()
79 ///          () () () () () () () ());
80 /// assert_eq!(1 + 1, 2);
81 /// ```
82 pub fn both_attrs() {}
83
84 /// ```
85 /// #![recursion_limit = "1024"]
86 /// #![feature(core_intrinsics)]
87 /// macro_rules! recurse {
88 ///     (()) => {};
89 ///     (() $($rest:tt)*) => { recurse!($($rest)*); }
90 /// }
91 /// recurse!(() () () () () () () ()
92 ///          () () () () () () () ()
93 ///          () () () () () () () ()
94 ///          () () () () () () () ()
95 ///          () () () () () () () ()
96 ///          () () () () () () () ()
97 ///          () () () () () () () ()
98 ///          () () () () () () () ()
99 ///          () () () () () () () ()
100 ///          () () () () () () () ()
101 ///          () () () () () () () ()
102 ///          () () () () () () () ()
103 ///          () () () () () () () ()
104 ///          () () () () () () () ()
105 ///          () () () () () () () ()
106 ///          () () () () () () () ());
107 /// assert_eq!(1 + 1, 2);
108 /// ```
109 pub fn both_attrs_reverse() {}
110