1 #![feature(generic_associated_types)]
4 pub trait MyTrait { fn dummy(&self) { } }
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 {}
13 pub struct Delta<D>(D);
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 {
21 pub struct Echo<E>(E);
23 // @has 'foo/struct.Simd.html'
24 // @snapshot SWhere_Simd_item-decl - '//div[@class="docblock item-decl"]'
25 pub struct Simd<T>([T; 1])
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;
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 {}
41 pub enum Foxtrot<F> { Foxtrot1(F) }
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 {}
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);