summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc/doc-notable_trait.rs
blob: 58a24b855d6e2f528c1da360719a0687c978e2fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#![feature(doc_notable_trait)]

pub struct Wrapper<T> {
    inner: T,
}

impl<T: SomeTrait> SomeTrait for Wrapper<T> {}

#[doc(notable_trait)]
pub trait SomeTrait {
    // @has doc_notable_trait/trait.SomeTrait.html
    // @has - '//code[@class="content"]' 'impl<T: SomeTrait> SomeTrait for Wrapper<T>'
    fn wrap_me(self) -> Wrapper<Self> where Self: Sized {
        Wrapper {
            inner: self,
        }
    }
}

pub struct SomeStruct;
impl SomeTrait for SomeStruct {}

impl SomeStruct {
    // @has doc_notable_trait/struct.SomeStruct.html
    // @has - '//code[@class="content"]' 'impl SomeTrait for SomeStruct'
    // @has - '//code[@class="content"]' 'impl<T: SomeTrait> SomeTrait for Wrapper<T>'
    pub fn new() -> SomeStruct {
        SomeStruct
    }
}

// @has doc_notable_trait/fn.bare_fn.html
// @has - '//code[@class="content"]' 'impl SomeTrait for SomeStruct'
pub fn bare_fn() -> SomeStruct {
    SomeStruct
}