]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/trait-impl.rs
Rollup merge of #84464 - jyn514:type-kind, r=CraftSpider
[rust.git] / src / test / rustdoc / trait-impl.rs
1 pub trait Trait {
2     /// Some long docs here.
3     ///
4     /// These docs are long enough that a link will be added to the end.
5     fn a();
6
7     /// These docs contain a [reference link].
8     ///
9     /// [reference link]: https://example.com
10     fn b();
11
12     /// ```
13     /// This code block should not be in the output, but a Read more link should be generated
14     /// ```
15     fn c();
16
17     /// Escaped formatting a\*b\*c\* works
18     fn d();
19 }
20
21 pub struct Struct;
22
23 impl Trait for Struct {
24     // @has trait_impl/struct.Struct.html '//*[@id="method.a"]/../div/p' 'Some long docs'
25     // @!has - '//*[@id="method.a"]/../div/p' 'link will be added'
26     // @has - '//*[@id="method.a"]/../div/p/a' 'Read more'
27     // @has - '//*[@id="method.a"]/../div/p/a/@href' 'trait.Trait.html'
28     fn a() {}
29
30     // @has trait_impl/struct.Struct.html '//*[@id="method.b"]/../div/p' 'These docs contain'
31     // @has - '//*[@id="method.b"]/../div/p/a' 'reference link'
32     // @has - '//*[@id="method.b"]/../div/p/a/@href' 'https://example.com'
33     // @has - '//*[@id="method.b"]/../div/p/a' 'Read more'
34     // @has - '//*[@id="method.b"]/../div/p/a/@href' 'trait.Trait.html'
35     fn b() {}
36
37     // @!has trait_impl/struct.Struct.html '//*[@id="method.c"]/../div/p' 'code block'
38     // @has - '//*[@id="method.c"]/../div/p/a' 'Read more'
39     // @has - '//*[@id="method.c"]/../div/p/a/@href' 'trait.Trait.html'
40     fn c() {}
41
42     // @has trait_impl/struct.Struct.html '//*[@id="method.d"]/../div/p' \
43     //   'Escaped formatting a*b*c* works'
44     // @!has trait_impl/struct.Struct.html '//*[@id="method.d"]/../div/p/em'
45     fn d() {}
46 }