1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![feature(coroutines, proc_macro_hygiene, stmt_expr_attributes)]
mod signature {
use futures_async_stream::stream;
#[stream(item = ())]
const fn constness() {} //~ ERROR async stream must be declared as async
#[stream(item = ())]
fn variadic(_: ...) {} //~ ERROR only foreign functions are allowed to be C-variadic
#[stream(item = ())]
fn asyncness() {} //~ ERROR async stream must be declared as async
#[stream(item = ())]
async fn output() -> i32 {} //~ ERROR async stream must return the unit type
#[stream(item = ())]
async fn unit() -> () {} // OK
#[stream(item = ())]
const async unsafe extern "C" fn f() {} //~ ERROR async stream may not be const
}
mod attribute {
use futures_async_stream::{for_await, stream, try_stream};
#[stream(item = ())]
async fn stream() {}
#[stream(item = ())]
#[stream(item = ())] //~ ERROR duplicate #[stream] attribute
async fn duplicate_stream_fn() {}
#[try_stream(ok = (), error = ())]
#[try_stream(ok = (), error = ())] //~ ERROR duplicate #[try_stream] attribute
async fn duplicate_try_stream_fn() {}
#[stream(item = ())]
#[try_stream(ok = (), error = ())] //~ ERROR may not be used at the same time
async fn combine_fn() {}
async fn duplicate_stream_async() {
let _ = {
#[stream]
#[stream] //~ ERROR duplicate #[stream] attribute
async move {}
};
}
async fn duplicate_try_stream_async() {
let _ = {
#[try_stream]
#[try_stream] //~ ERROR duplicate #[try_stream] attribute
async move {}
};
}
async fn duplicate_for_await() {
#[for_await]
#[for_await] //~ ERROR duplicate #[for_await] attribute
for () in stream() {}
}
async fn combine_async() {
let _ = {
#[stream]
#[try_stream] //~ ERROR may not be used at the same time
async move {}
};
}
#[stream(item = ())]
async fn duplicate_stream_async_in_fn() {
let _ = {
#[stream]
#[stream] //~ ERROR duplicate #[stream] attribute
async move {}
};
}
#[stream(item = ())]
async fn duplicate_try_stream_async_in_fn() {
let _ = {
#[try_stream]
#[try_stream] //~ ERROR duplicate #[try_stream] attribute
async move {}
};
}
#[stream(item = ())]
async fn duplicate_for_await_in_fn() {
#[for_await]
#[for_await] //~ ERROR duplicate #[for_await] attribute
for () in stream() {}
}
#[stream(item = ())]
async fn combine_async_in_fn() {
let _ = {
#[stream]
#[try_stream] //~ ERROR may not be used at the same time
async move {}
};
}
}
mod item {
use futures_async_stream::stream;
#[stream(item = ())] //~ ERROR #[stream] attribute may only be used on async functions or async blocks
mod m {}
#[stream(item = ())] //~ ERROR #[stream] attribute may only be used on async functions or async blocks
trait A {}
#[stream(item = ())] //~ ERROR #[stream] attribute may only be used on async functions or async blocks
impl A {}
}
fn main() {}