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