]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/doc-notable_trait.rs
Migrate `rustc_parse` to derive diagnostics
[rust.git] / tests / rustdoc / doc-notable_trait.rs
1 #![feature(doc_notable_trait)]
2
3 pub struct Wrapper<T> {
4     inner: T,
5 }
6
7 impl<T: SomeTrait> SomeTrait for Wrapper<T> {}
8
9 #[doc(notable_trait)]
10 pub trait SomeTrait {
11     // @has doc_notable_trait/trait.SomeTrait.html
12     // @has - '//a[@class="notable-traits"]/@data-ty' 'Wrapper<Self>'
13     // @snapshot wrap-me - '//script[@id="notable-traits-data"]'
14     fn wrap_me(self) -> Wrapper<Self> where Self: Sized {
15         Wrapper {
16             inner: self,
17         }
18     }
19 }
20
21 pub struct SomeStruct;
22 impl SomeTrait for SomeStruct {}
23
24 impl SomeStruct {
25     // @has doc_notable_trait/struct.SomeStruct.html
26     // @has - '//a[@class="notable-traits"]/@data-ty' 'SomeStruct'
27     // @snapshot some-struct-new - '//script[@id="notable-traits-data"]'
28     pub fn new() -> SomeStruct {
29         SomeStruct
30     }
31 }
32
33 // @has doc_notable_trait/fn.bare_fn.html
34 // @has - '//a[@class="notable-traits"]/@data-ty' 'SomeStruct'
35 // @snapshot bare-fn - '//script[@id="notable-traits-data"]'
36 pub fn bare_fn() -> SomeStruct {
37     SomeStruct
38 }