Skip to content

Commit 94e115e

Browse files
committed
Improve return type annotation in async fn examples
In two examples involving `async fn`, we annotate the returned opaque type in comments. In these comments, we had notated the trait bounds, but we had not included the keyword `impl`. Let's include that keyword for greater clarity. We'll also add backticks around the annotated return type in the second example. These were already present in the first example.
1 parent 38cd2e4 commit 94e115e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text/3498-lifetime-capture-rules-2024.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In return position `impl Trait` (RPIT) and `async fn`, an **opaque type** is a t
2424
A hidden type is only allowed to name lifetime parameters when those lifetime parameters have been *"captured"* by the corresponding opaque type. For example:[^ref-captures-trait-ltps]
2525

2626
```rust
27-
// Returns: `Future<Output = ()> + Captures<&'a ()>`
27+
// Returns: `impl Future<Output = ()> + Captures<&'a ()>`
2828
async fn foo<'a>(x: &'a ()) { _ = (x,); }
2929
```
3030

@@ -43,7 +43,7 @@ See [Appendix H] for examples and further exposition of these rules.
4343
In return position `impl Trait` (RPIT) and `async fn`, lifetimes contained within all in-scope type parameters are captured in the opaque type. For example:[^ref-captures-trait-tps]
4444

4545
```rust
46-
// Returns: Future<Output = ()> + Captures<T>
46+
// Returns: `impl Future<Output = ()> + Captures<T>`
4747
async fn foo<T>(x: T) { _ = (x,); }
4848

4949
fn bar<'a>(x: &'a ()) {

0 commit comments

Comments
 (0)