]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/issue-43869.rs
Auto merge of #68661 - nnethercote:rm-unused-read_uleb128-param, r=Mark-Simulacrum
[rust.git] / src / test / rustdoc / issue-43869.rs
1 pub fn g() -> impl Iterator<Item=u8> {
2     Some(1u8).into_iter()
3 }
4
5 pub fn h() -> (impl Iterator<Item=u8>) {
6     Some(1u8).into_iter()
7 }
8
9 pub fn i() -> impl Iterator<Item=u8> + 'static {
10     Some(1u8).into_iter()
11 }
12
13 pub fn j() -> impl Iterator<Item=u8> + Clone {
14     Some(1u8).into_iter()
15 }
16
17 pub fn k() -> [impl Clone; 2] {
18     [123u32, 456u32]
19 }
20
21 pub fn l() -> (impl Clone, impl Default) {
22     (789u32, -123i32)
23 }
24
25 pub fn m() -> &'static impl Clone {
26     &1u8
27 }
28
29 pub fn n() -> *const impl Clone {
30     &1u8
31 }
32
33 pub fn o() -> &'static [impl Clone] {
34     b":)"
35 }
36
37 // issue #44731
38 pub fn test_44731_0() -> Box<impl Iterator<Item=u8>> {
39     Box::new(g())
40 }
41
42 pub fn test_44731_1() -> Result<Box<impl Clone>, ()> {
43     Ok(Box::new(j()))
44 }
45
46 // NOTE these involve Fn sugar, where impl Trait is disallowed for now, see issue #45994
47 //
48 //pub fn test_44731_2() -> Box<Fn(impl Clone)> {
49 //    Box::new(|_: u32| {})
50 //}
51 //
52 //pub fn test_44731_3() -> Box<Fn() -> impl Clone> {
53 //    Box::new(|| 0u32)
54 //}
55
56 pub fn test_44731_4() -> Box<Iterator<Item=impl Clone>> {
57     Box::new(g())
58 }
59
60 // @has issue_43869/fn.g.html
61 // @has issue_43869/fn.h.html
62 // @has issue_43869/fn.i.html
63 // @has issue_43869/fn.j.html
64 // @has issue_43869/fn.k.html
65 // @has issue_43869/fn.l.html
66 // @has issue_43869/fn.m.html
67 // @has issue_43869/fn.n.html
68 // @has issue_43869/fn.o.html
69 // @has issue_43869/fn.test_44731_0.html
70 // @has issue_43869/fn.test_44731_1.html
71 // @has issue_43869/fn.test_44731_4.html