1 #![crate_name = "foo"]
2 
3 use std::io::Read;
4 use std::borrow::Borrow;
5 
6 // @has foo/fn.foo.html
7 // @has - //pre 'foo('
8 // @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Clone\.html"'
9 // @matches - '_z: .+impl.+trait\.Copy\.html.+, impl.+trait\.Clone\.html'
foo(_x: impl Clone, _y: i32, _z: (impl Copy, impl Clone))10 pub fn foo(_x: impl Clone, _y: i32, _z: (impl Copy, impl Clone)) {
11 }
12 
13 pub trait Trait {
14     // @has foo/trait.Trait.html
15     // @has - 'method</a>('
16     // @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"'
method(&self, _x: impl std::fmt::Debug)17     fn method(&self, _x: impl std::fmt::Debug) {
18     }
19 }
20 
21 pub struct S<T>(T);
22 
23 impl<T> S<T> {
24     // @has foo/struct.S.html
25     // @has - 'bar</a>('
26     // @matches - '_bar: impl <a class="trait" href="[^"]+/trait\.Copy\.html"'
bar(_bar: impl Copy)27     pub fn bar(_bar: impl Copy) {
28     }
29 
30     // @has - 'baz</a>('
31     // @matches - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html'
baz(_baz: S<impl Clone>)32     pub fn baz(_baz: S<impl Clone>) {
33     }
34 
35     // @has - 'qux</a>('
36     // @matches - 'trait\.Read\.html'
qux(_qux: impl IntoIterator<Item = S<impl Read>>)37     pub fn qux(_qux: impl IntoIterator<Item = S<impl Read>>) {
38     }
39 }
40 
41 // @has - 'method</a>('
42 // @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"'
43 impl<T> Trait for S<T> {}
44 
45 // @has foo/fn.much_universe.html
46 // @matches - 'T:.+Borrow.+impl .+trait\.Trait\.html'
47 // @matches - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html'
48 // @matches - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html'
much_universe< T: Borrow<impl Trait>, U: IntoIterator<Item = impl Iterator<Item = impl Clone>>, >( _: impl Read + Clone, )49 pub fn much_universe<
50     T: Borrow<impl Trait>,
51     U: IntoIterator<Item = impl Iterator<Item = impl Clone>>,
52 >(
53     _: impl Read + Clone,
54 ) {
55 }
56