]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/issue-38129.rs
Rollup merge of #106717 - klensy:typo, r=lcnr
[rust.git] / tests / rustdoc / issue-38129.rs
1 // compile-flags:--test
2
3 // This file tests the source-partitioning behavior of rustdoc.
4 // Each test contains some code that should be put into the generated
5 // `fn main` and some attributes should be left outside (except the first
6 // one, which has no attributes).
7 // If the #![recursion_limit] attribute is incorrectly left inside,
8 // then the tests will fail because the macro recurses 128 times.
9
10 /// ```
11 /// assert_eq!(1 + 1, 2);
12 /// ```
13 pub fn simple() {}
14
15 /// ```
16 /// #![recursion_limit = "1024"]
17 /// macro_rules! recurse {
18 ///     (()) => {};
19 ///     (() $($rest:tt)*) => { recurse!($($rest)*); }
20 /// }
21 /// recurse!(() () () () () () () ()
22 ///          () () () () () () () ()
23 ///          () () () () () () () ()
24 ///          () () () () () () () ()
25 ///          () () () () () () () ()
26 ///          () () () () () () () ()
27 ///          () () () () () () () ()
28 ///          () () () () () () () ()
29 ///          () () () () () () () ()
30 ///          () () () () () () () ()
31 ///          () () () () () () () ()
32 ///          () () () () () () () ()
33 ///          () () () () () () () ()
34 ///          () () () () () () () ()
35 ///          () () () () () () () ()
36 ///          () () () () () () () ());
37 /// assert_eq!(1 + 1, 2);
38 /// ```
39 pub fn non_feature_attr() {}
40
41 /// ```
42 /// #![feature(core_intrinsics)]
43 /// assert_eq!(1 + 1, 2);
44 /// ```
45 pub fn feature_attr() {}
46
47 /// ```
48 /// #![feature(core_intrinsics)]
49 /// #![recursion_limit = "1024"]
50 /// macro_rules! recurse {
51 ///     (()) => {};
52 ///     (() $($rest:tt)*) => { recurse!($($rest)*); }
53 /// }
54 /// recurse!(() () () () () () () ()
55 ///          () () () () () () () ()
56 ///          () () () () () () () ()
57 ///          () () () () () () () ()
58 ///          () () () () () () () ()
59 ///          () () () () () () () ()
60 ///          () () () () () () () ()
61 ///          () () () () () () () ()
62 ///          () () () () () () () ()
63 ///          () () () () () () () ()
64 ///          () () () () () () () ()
65 ///          () () () () () () () ()
66 ///          () () () () () () () ()
67 ///          () () () () () () () ()
68 ///          () () () () () () () ()
69 ///          () () () () () () () ());
70 /// assert_eq!(1 + 1, 2);
71 /// ```
72 pub fn both_attrs() {}
73
74 /// ```
75 /// #![recursion_limit = "1024"]
76 /// #![feature(core_intrinsics)]
77 /// macro_rules! recurse {
78 ///     (()) => {};
79 ///     (() $($rest:tt)*) => { recurse!($($rest)*); }
80 /// }
81 /// recurse!(() () () () () () () ()
82 ///          () () () () () () () ()
83 ///          () () () () () () () ()
84 ///          () () () () () () () ()
85 ///          () () () () () () () ()
86 ///          () () () () () () () ()
87 ///          () () () () () () () ()
88 ///          () () () () () () () ()
89 ///          () () () () () () () ()
90 ///          () () () () () () () ()
91 ///          () () () () () () () ()
92 ///          () () () () () () () ()
93 ///          () () () () () () () ()
94 ///          () () () () () () () ()
95 ///          () () () () () () () ()
96 ///          () () () () () () () ());
97 /// assert_eq!(1 + 1, 2);
98 /// ```
99 pub fn both_attrs_reverse() {}