]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/where.rs
Rollup merge of #100353 - theli-ua:master, r=joshtriplett
[rust.git] / src / test / rustdoc / where.rs
1 #![feature(generic_associated_types)]
2 #![crate_name = "foo"]
3
4 pub trait MyTrait { fn dummy(&self) { } }
5
6 // @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_) where A: MyTrait"
7 pub struct Alpha<A>(A) where A: MyTrait;
8 // @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B> where B: MyTrait"
9 pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); }
10 // @has foo/fn.charlie.html '//pre' "pub fn charlie<C>() where C: MyTrait"
11 pub fn charlie<C>() where C: MyTrait {}
12
13 pub struct Delta<D>(D);
14
15 // @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
16 //          "impl<D> Delta<D> where D: MyTrait"
17 impl<D> Delta<D> where D: MyTrait {
18     pub fn delta() {}
19 }
20
21 pub struct Echo<E>(E);
22
23 // @has 'foo/struct.Simd.html'
24 // @snapshot SWhere_Simd_item-decl - '//div[@class="docblock item-decl"]'
25 pub struct Simd<T>([T; 1])
26 where
27     T: MyTrait;
28
29 // @has 'foo/trait.TraitWhere.html'
30 // @snapshot SWhere_TraitWhere_item-decl - '//div[@class="docblock item-decl"]'
31 pub trait TraitWhere {
32     type Item<'a> where Self: 'a;
33 }
34
35 // @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
36 //          "impl<E> MyTrait for Echo<E> where E: MyTrait"
37 // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header in-band"]' \
38 //          "impl<E> MyTrait for Echo<E> where E: MyTrait"
39 impl<E> MyTrait for Echo<E> where E: MyTrait {}
40
41 pub enum Foxtrot<F> { Foxtrot1(F) }
42
43 // @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
44 //          "impl<F> MyTrait for Foxtrot<F> where F: MyTrait"
45 // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header in-band"]' \
46 //          "impl<F> MyTrait for Foxtrot<F> where F: MyTrait"
47 impl<F> MyTrait for Foxtrot<F> where F: MyTrait {}
48
49 // @has foo/type.Golf.html '//pre[@class="rust typedef"]' \
50 //          "type Golf<T> where T: Clone, = (T, T)"
51 pub type Golf<T> where T: Clone = (T, T);