]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/issue-43869.rs
New upstream version 1.59.0+dfsg1
[rustc.git] / src / test / rustdoc / issue-43869.rs
CommitLineData
3b2f2976
XL
1pub fn g() -> impl Iterator<Item=u8> {
2 Some(1u8).into_iter()
223e47cc 3}
3b2f2976 4
a2a8927a 5#[allow(unused_parens)]
3b2f2976
XL
6pub fn h() -> (impl Iterator<Item=u8>) {
7 Some(1u8).into_iter()
8}
9
10pub fn i() -> impl Iterator<Item=u8> + 'static {
11 Some(1u8).into_iter()
12}
13
14pub fn j() -> impl Iterator<Item=u8> + Clone {
15 Some(1u8).into_iter()
16}
17
ea8adc8c
XL
18pub fn k() -> [impl Clone; 2] {
19 [123u32, 456u32]
20}
21
22pub fn l() -> (impl Clone, impl Default) {
23 (789u32, -123i32)
24}
25
26pub fn m() -> &'static impl Clone {
27 &1u8
28}
29
30pub fn n() -> *const impl Clone {
31 &1u8
32}
33
34pub fn o() -> &'static [impl Clone] {
35 b":)"
36}
37
38// issue #44731
39pub fn test_44731_0() -> Box<impl Iterator<Item=u8>> {
40 Box::new(g())
41}
42
43pub 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
57pub 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