]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc-gui/src/lib.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / rustdoc-gui / src / lib.rs
CommitLineData
6a06907d
XL
1//! The point of this crate is to be able to have enough different "kinds" of
2//! documentation generated so we can test each different features.
3
4#![crate_name = "test_docs"]
17df50a5 5#![feature(doc_keyword)]
6a06907d
XL
6
7use std::fmt;
8
9/// Basic function with some code examples:
10///
11/// ```
12/// println!("nothing fancy");
13/// ```
14///
15/// A failing to compile one:
16///
17/// ```compile_fail
18/// println!("where did my argument {} go? :'(");
19/// ```
20///
21/// An ignored one:
22///
23/// ```ignore (it's a test)
24/// Let's say I'm just some text will ya?
25/// ```
26pub fn foo() {}
27
28/// Just a normal struct.
29pub struct Foo;
30
31impl Foo {
32 #[must_use]
cdc7bbd5
XL
33 pub fn must_use(&self) -> bool {
34 true
35 }
6a06907d
XL
36}
37
38/// Just a normal enum.
17df50a5 39#[doc(alias = "ThisIsAnAlias")]
6a06907d
XL
40pub enum WhoLetTheDogOut {
41 /// Woof!
42 Woof,
43 /// Meoooooooow...
44 Meow,
45}
46
47/// Who doesn't love to wrap a `format!` call?
48pub fn some_more_function<T: fmt::Debug>(t: &T) -> String {
49 format!("{:?}", t)
50}
51
52/// Woohoo! A trait!
53pub trait AnotherOne {
cdc7bbd5
XL
54 /// Some func 3.
55 fn func3();
56
6a06907d
XL
57 /// Some func 1.
58 fn func1();
59
cdc7bbd5
XL
60 fn another();
61 fn why_not();
62
6a06907d
XL
63 /// Some func 2.
64 fn func2();
65
cdc7bbd5 66 fn hello();
6a06907d
XL
67}
68
cdc7bbd5
XL
69/// ```compile_fail
70/// whatever
71/// ```
72///
6a06907d
XL
73/// Check for "i" signs in lists!
74///
75/// 1. elem 1
cdc7bbd5
XL
76/// 2. test 1
77/// ```compile_fail
78/// fn foo() {}
79/// ```
6a06907d
XL
80/// 3. elem 3
81/// 4. ```ignore (it's a test)
82/// fn foo() {}
83/// ```
84/// 5. elem 5
cdc7bbd5
XL
85///
86/// Final one:
87///
88/// ```ignore (still a test)
89/// let x = 12;
90/// ```
6a06907d 91pub fn check_list_code_block() {}
cdc7bbd5
XL
92
93pub enum AnEnum {
94 WithVariants { and: usize, sub: usize, variants: usize },
95}
17df50a5
XL
96
97#[doc(keyword = "CookieMonster")]
98pub mod keyword {}
99
100/// Just some type alias.
101pub type SomeType = u32;