]> git.proxmox.com Git - rustc.git/blob - src/test/rustdoc/where.rs
New upstream version 1.27.1+dfsg1
[rustc.git] / src / test / rustdoc / where.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![crate_name = "foo"]
12
13 pub trait MyTrait { fn dummy(&self) { } }
14
15 // @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_) where A: MyTrait"
16 pub struct Alpha<A>(A) where A: MyTrait;
17 // @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B> where B: MyTrait"
18 pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); }
19 // @has foo/fn.charlie.html '//pre' "pub fn charlie<C>() where C: MyTrait"
20 pub fn charlie<C>() where C: MyTrait {}
21
22 pub struct Delta<D>(D);
23
24 // @has foo/struct.Delta.html '//*[@class="impl"]//code' \
25 // "impl<D> Delta<D> where D: MyTrait"
26 impl<D> Delta<D> where D: MyTrait {
27 pub fn delta() {}
28 }
29
30 pub struct Echo<E>(E);
31
32 // @has foo/struct.Echo.html '//*[@class="impl"]//code' \
33 // "impl<E> MyTrait for Echo<E> where E: MyTrait"
34 // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \
35 // "impl<E> MyTrait for Echo<E> where E: MyTrait"
36 impl<E> MyTrait for Echo<E> where E: MyTrait {}
37
38 pub enum Foxtrot<F> { Foxtrot1(F) }
39
40 // @has foo/enum.Foxtrot.html '//*[@class="impl"]//code' \
41 // "impl<F> MyTrait for Foxtrot<F> where F: MyTrait"
42 // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \
43 // "impl<F> MyTrait for Foxtrot<F> where F: MyTrait"
44 impl<F> MyTrait for Foxtrot<F> where F: MyTrait {}
45
46 // @has foo/type.Golf.html '//pre[@class="rust typedef"]' \
47 // "type Golf<T> where T: Clone, = (T, T)"
48 pub type Golf<T> where T: Clone = (T, T);