]>
Commit | Line | Data |
---|---|---|
9346a6ac AL |
1 | #![crate_name = "foo"] |
2 | ||
f2b60f7d FG |
3 | use std::io::Lines; |
4 | ||
85aaf69f | 5 | pub trait MyTrait { fn dummy(&self) { } } |
223e47cc | 6 | |
f2b60f7d | 7 | // @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_)where A: MyTrait" |
85aaf69f | 8 | pub struct Alpha<A>(A) where A: MyTrait; |
f2b60f7d | 9 | // @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B>where B: MyTrait" |
85aaf69f | 10 | pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); } |
f2b60f7d | 11 | // @has foo/fn.charlie.html '//pre' "pub fn charlie<C>()where C: MyTrait" |
1a4d82fc | 12 | pub fn charlie<C>() where C: MyTrait {} |
223e47cc | 13 | |
85aaf69f SL |
14 | pub struct Delta<D>(D); |
15 | ||
2b03887a | 16 | // @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ |
f2b60f7d | 17 | // "impl<D> Delta<D>where D: MyTrait" |
1a4d82fc JJ |
18 | impl<D> Delta<D> where D: MyTrait { |
19 | pub fn delta() {} | |
20 | } | |
223e47cc | 21 | |
85aaf69f SL |
22 | pub struct Echo<E>(E); |
23 | ||
04454e1e | 24 | // @has 'foo/struct.Simd.html' |
2b03887a | 25 | // @snapshot SWhere_Simd_item-decl - '//div[@class="item-decl"]' |
04454e1e FG |
26 | pub struct Simd<T>([T; 1]) |
27 | where | |
28 | T: MyTrait; | |
29 | ||
30 | // @has 'foo/trait.TraitWhere.html' | |
2b03887a | 31 | // @snapshot SWhere_TraitWhere_item-decl - '//div[@class="item-decl"]' |
04454e1e FG |
32 | pub trait TraitWhere { |
33 | type Item<'a> where Self: 'a; | |
f2b60f7d FG |
34 | |
35 | fn func(self) | |
36 | where | |
37 | Self: Sized | |
38 | {} | |
39 | ||
40 | fn lines(self) -> Lines<Self> | |
41 | where | |
42 | Self: Sized, | |
43 | { todo!() } | |
04454e1e FG |
44 | } |
45 | ||
2b03887a | 46 | // @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ |
f2b60f7d | 47 | // "impl<E> MyTrait for Echo<E>where E: MyTrait" |
2b03887a | 48 | // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ |
f2b60f7d FG |
49 | // "impl<E> MyTrait for Echo<E>where E: MyTrait" |
50 | impl<E> MyTrait for Echo<E>where E: MyTrait {} | |
223e47cc | 51 | |
85aaf69f SL |
52 | pub enum Foxtrot<F> { Foxtrot1(F) } |
53 | ||
2b03887a | 54 | // @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ |
f2b60f7d | 55 | // "impl<F> MyTrait for Foxtrot<F>where F: MyTrait" |
2b03887a | 56 | // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ |
f2b60f7d FG |
57 | // "impl<F> MyTrait for Foxtrot<F>where F: MyTrait" |
58 | impl<F> MyTrait for Foxtrot<F>where F: MyTrait {} | |
62682a34 SL |
59 | |
60 | // @has foo/type.Golf.html '//pre[@class="rust typedef"]' \ | |
f2b60f7d | 61 | // "type Golf<T>where T: Clone, = (T, T)" |
62682a34 | 62 | pub type Golf<T> where T: Clone = (T, T); |