You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/inside-rust/2024-09-26-rtn-call-for-testing.md
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: Michael Goulet
5
5
team: The Async Working Group <https://www.rust-lang.org/governance/wgs/wg-async>
6
6
---
7
7
8
-
The async working group is excited to announce that [RFC 3654] return type notation (RTN) is ready for testing. In this post, we want to briefly describe the feature and announce a call for testing on nightly Rust.
8
+
The async working group is excited to announce that [RFC 3654] return type notation (RTN) is ready for testing on nightly Rust. In this post, we'll briefly describe the feature.
9
9
10
10
## The backstory
11
11
@@ -24,7 +24,8 @@ trait Foo {
24
24
25
25
fnneeds_sendable_future<T:Foo>()
26
26
where
27
-
// How do we further restrict `T::method()` to be `Send + 'static`?
27
+
// How do we further restrict `T::method()`
28
+
// to be `Send + 'static`?
28
29
{
29
30
spawn(T::method());
30
31
//~^ ERROR: `impl Future<Output = ()>` is not `Send`!
@@ -69,7 +70,7 @@ In [RFC 3654] we introduced return type notation (RTN). This will allow us to wr
69
70
```rust
70
71
fnneeds_sendable_future<T:Foo>()
71
72
where
72
-
T::method(..):Send+ 'static//✨
73
+
T::method(..):Send+ 'static//Yay!
73
74
{
74
75
spawn(T::method());
75
76
//~^ Works!
@@ -80,16 +81,16 @@ where
80
81
81
82
Currently, RTN is only allowed for trait associated functions and methods with lifetime generics (not const or type generics) that use:
82
83
83
-
* async fn in traits (AFIT)
84
-
* return-position impl Trait in traits (RPITIT) where the impl Trait is the outermost return type, i.e. `-> impl Trait`, but not `-> Box<impl Trait>`
84
+
* async fn in traits (AFIT) or
85
+
* return-position impl Trait in traits (RPITIT) where the impl Trait is the outermost return type, i.e. `-> impl Trait`, but not `-> Box<impl Trait>`.
85
86
86
87
These restrictions are described in further detail in [RFC 3654].
87
88
88
89
## How do I help?
89
90
90
91
We'd love for you to test out this feature on the latest Rust nightly compiler[^nightly].
91
92
92
-
[^nightly]: Make sure to run `rustup update nightly` or however you manage your Rust releases, since the feature is very new and is still unstable!
93
+
[^nightly]: Make sure to run `rustup update nightly`(or however you manage your Rust releases), since the feature is very new and is still unstable!
93
94
94
95
Specifically, we'd like for you to identify traits where you're unnecessarily restricting your trait definitions with `+ Send` or similar bounds:
0 commit comments