]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/higher-ranked-trait-bounds.rs
Fix feature gate checking of static-nobundle and native_link_modifiers
[rust.git] / src / test / rustdoc / higher-ranked-trait-bounds.rs
1 #![crate_name = "foo"]
2
3 // @has foo/trait.Trait.html
4 pub trait Trait<'x> {}
5
6 // @has foo/fn.test1.html
7 // @has - '//pre' "pub fn test1<T>() where for<'a> &'a T: Iterator,"
8 pub fn test1<T>()
9 where
10     for<'a> &'a T: Iterator,
11 {
12 }
13
14 // @has foo/fn.test2.html
15 // @has - '//pre' "pub fn test2<T>() where for<'a, 'b> &'a T: Trait<'b>,"
16 pub fn test2<T>()
17 where
18     for<'a, 'b> &'a T: Trait<'b>,
19 {
20 }
21
22 // @has foo/fn.test3.html
23 // @has - '//pre' "pub fn test3<F>() where F: for<'a, 'b> Fn(&'a u8, &'b u8),"
24 pub fn test3<F>()
25 where
26     F: for<'a, 'b> Fn(&'a u8, &'b u8),
27 {
28 }
29
30 // @has foo/struct.Foo.html
31 pub struct Foo<'a> {
32     _x: &'a u8,
33     pub some_trait: &'a dyn for<'b> Trait<'b>,
34     pub some_func: for<'c> fn(val: &'c i32) -> i32,
35 }
36
37 // @has - '//span[@id="structfield.some_func"]' "some_func: for<'c> fn(val: &'c i32) -> i32"
38 // @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>"
39
40 impl<'a> Foo<'a> {
41     // @has - '//code' "pub fn bar<T>() where T: Trait<'a>,"
42     pub fn bar<T>()
43     where
44         T: Trait<'a>,
45     {
46     }
47 }
48
49 // @has foo/trait.B.html
50 pub trait B<'x> {}
51
52 // @has - '//code[@class="in-band"]' "impl<'a> B<'a> for dyn for<'b> Trait<'b>"
53 impl<'a> B<'a> for dyn for<'b> Trait<'b> {}
54
55 // @has foo/struct.Bar.html
56 // @has - '//span[@id="structfield.bar"]' "bar: &'a (dyn for<'b> Trait<'b> + Unpin)"
57 // @has - '//span[@id="structfield.baz"]' "baz: &'a (dyn Unpin + for<'b> Trait<'b>)"
58 pub struct Bar<'a> {
59     pub bar: &'a (dyn for<'b> Trait<'b> + Unpin),
60     pub baz: &'a (dyn Unpin + for<'b> Trait<'b>),
61 }