+11
Cargo.lock
+11
Cargo.lock
···
3
3
version = 4
4
4
5
5
[[package]]
6
+
name = "futures"
7
+
version = "0.1.0"
8
+
dependencies = [
9
+
"futures-combinators",
10
+
"futures-compat",
11
+
"futures-core",
12
+
"futures-derive",
13
+
"futures-util",
14
+
]
15
+
16
+
[[package]]
6
17
name = "futures-combinators"
7
18
version = "0.1.0"
8
19
dependencies = [
+1
-1
Cargo.toml
+1
-1
Cargo.toml
···
1
1
[workspace]
2
2
resolver = "3"
3
-
members = [ "futures-core", "futures-combinators", "futures-compat", "futures-derive", "futures-util"]
3
+
members = [ "futures", "futures-core", "futures-combinators", "futures-compat", "futures-derive", "futures-util"]
4
4
5
5
[workspace.package]
6
6
version = "0.1.0"
-10
futures-compat/src/lib.rs
-10
futures-compat/src/lib.rs
+5
futures-core/src/lib.rs
+5
futures-core/src/lib.rs
···
35
35
/// The waker is no longer tied to the actual future's lifetime, making it
36
36
/// unsound to not have either static tasks or reference counting.
37
37
/// To avoid this, we want to use a &'scope waker instead, with 1 waker / task.
38
+
#[diagnostic::on_unimplemented(
39
+
message = "The type `{Self}` must implement the `ScopedFuture` trait.",
40
+
label = "Missing `ScopedFuture` implementation",
41
+
note = "If you are trying to await a `task::Future` from within a `ScopedFuture`, note that the systems are incompatible."
42
+
)]
38
43
pub trait ScopedFuture<'scope> {
39
44
type Output;
40
45
+4
-2
futures-derive/src/lib.rs
+4
-2
futures-derive/src/lib.rs
···
75
75
})
76
76
.collect();
77
77
78
+
// let has_refs = inputs
79
+
78
80
quote! {
79
-
#(#attrs)* #vis #constness #unsafety fn #ident #generics (#inputs) -> impl ScopedFuture<'_, Output = #output> + '_ {
80
-
async fn #constness #unsafety fn __inner (#inputs) -> #output #block
81
+
#(#attrs)* #vis #constness #unsafety fn #ident #generics (#inputs) -> impl futures_core::ScopedFuture<'_, Output = #output> + '_ {
82
+
async #constness #unsafety fn __inner (#inputs) -> #output #block
81
83
82
84
let future = __inner(#(#inner_args),*);
83
85
+15
-1
futures/src/lib.rs
+15
-1
futures/src/lib.rs
···
1
-
fn test() {}
1
+
#![no_std]
2
+
3
+
pub use futures_combinators;
4
+
pub use futures_core;
5
+
pub use futures_derive::async_scoped;
6
+
pub use futures_util;
7
+
8
+
async fn evil() {}
9
+
10
+
#[async_scoped]
11
+
fn test<'a>(a: i32, b: &i32) {
12
+
// evil().await
13
+
}
14
+
15
+
fn test2<'a>(a: i32) {}