]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/where.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / rustdoc / where.rs
CommitLineData
9346a6ac
AL
1#![crate_name = "foo"]
2
f2b60f7d
FG
3use std::io::Lines;
4
85aaf69f 5pub trait MyTrait { fn dummy(&self) { } }
223e47cc 6
f2b60f7d 7// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_)where A: MyTrait"
85aaf69f 8pub struct Alpha<A>(A) where A: MyTrait;
f2b60f7d 9// @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B>where B: MyTrait"
85aaf69f 10pub 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 12pub fn charlie<C>() where C: MyTrait {}
223e47cc 13
85aaf69f
SL
14pub 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
18impl<D> Delta<D> where D: MyTrait {
19 pub fn delta() {}
20}
223e47cc 21
85aaf69f
SL
22pub 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
26pub struct Simd<T>([T; 1])
27where
28 T: MyTrait;
29
30// @has 'foo/trait.TraitWhere.html'
2b03887a 31// @snapshot SWhere_TraitWhere_item-decl - '//div[@class="item-decl"]'
04454e1e
FG
32pub 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"
50impl<E> MyTrait for Echo<E>where E: MyTrait {}
223e47cc 51
85aaf69f
SL
52pub 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"
58impl<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 62pub type Golf<T> where T: Clone = (T, T);