File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #![ feature( doc_label_trait) ]
2+ #![ crate_name = "foo" ]
3+
4+ #[ doc( label_trait) ]
5+ pub trait Labeled { }
6+
7+ #[ doc( label_trait) ]
8+ pub trait AlsoLabeled { }
9+
10+ pub trait Plain { }
11+
12+ //@ has 'foo/struct.Tagged.html'
13+ //@ has - '//a[@class="impl-label-trait-full-badge"][@href="trait.Labeled.html"][@title="foo::Labeled"]' 'Labeled'
14+ // Badges are sorted by trait name, so `AlsoLabeled` precedes `Labeled`.
15+ //@ has - '//div[@class="impl-label-trait-full-badge-container"]/a[1]' 'AlsoLabeled'
16+ //@ has - '//div[@class="impl-label-trait-full-badge-container"]/a[2]' 'Labeled'
17+ pub struct Tagged ;
18+ impl Labeled for Tagged { }
19+ impl AlsoLabeled for Tagged { }
20+ impl Plain for Tagged { }
21+
22+ //@ has 'foo/struct.Untagged.html'
23+ //@ count - '//div[@class="impl-label-trait-full-badge-container"]' 0
24+ pub struct Untagged ;
25+ impl Plain for Untagged { }
Original file line number Diff line number Diff line change 1+ #![ feature( doc_label_trait) ]
2+ #![ crate_name = "foo" ]
3+
4+ #[ doc( label_trait) ]
5+ pub trait Labeled { }
6+
7+ pub trait Bound { }
8+
9+ // A conditional impl: the badge is rendered unconditionally even though the
10+ // impl only holds for `T: Bound`.
11+ //@ has 'foo/struct.Wrapper.html' '//a[@class="impl-label-trait-full-badge"]' 'Labeled'
12+ pub struct Wrapper < T > ( pub T ) ;
13+ impl < T : Bound > Labeled for Wrapper < T > { }
Original file line number Diff line number Diff line change 1+ #![ feature( doc_label_trait, negative_impls) ]
2+ #![ crate_name = "foo" ]
3+
4+ #[ doc( label_trait) ]
5+ pub trait Labeled { }
6+
7+ // A negative impl must not produce a badge.
8+ //@ count 'foo/struct.Neg.html' '//div[@class="impl-label-trait-full-badge-container"]' 0
9+ pub struct Neg ;
10+ impl !Labeled for Neg { }
Original file line number Diff line number Diff line change 1+ #![ feature( doc_label_trait) ]
2+ #![ crate_name = "foo" ]
3+
4+ #[ doc( label_trait) ]
5+ pub trait Base { }
6+
7+ pub trait Derived : Base { }
8+
9+ //@ has 'foo/struct.S.html'
10+ // Implementing `Derived` requires implementing the label supertrait `Base`,
11+ // so its badge shows up.
12+ //@ count - '//a[@class="impl-label-trait-full-badge"]' 1
13+ //@ has - '//a[@class="impl-label-trait-full-badge"]' 'Base'
14+ pub struct S ;
15+ impl Base for S { }
16+ impl Derived for S { }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments