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