Skip to content

Commit a079159

Browse files
authored
Remove desugared async-trait example
1 parent 846f5e6 commit a079159

File tree

1 file changed

+1
-22
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+1
-22
lines changed

src/librustc_error_codes/error_codes/E0706.md

+1-22
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,7 @@ impl MyDatabase {
4242

4343
Until these issues are resolved, you can use the [`async-trait` crate], allowing you to use
4444
`async fn` in traits by desugaring to "boxed futures"
45-
(`Pin<Box<dyn Future + Send + 'async>>`):
46-
47-
```edition2018,ignore (example-of-desugaring-equivalence)
48-
#[async_trait]
49-
impl MyDatabase {
50-
async fn get_user(&self) -> User {
51-
unimplemented!()
52-
}
53-
}
54-
55-
// The annotated impl above gets desugared as follows:
56-
impl MyDatabase {
57-
fn get_user<'async>(
58-
&'async self,
59-
) -> Pin<Box<dyn std::future::Future<Output = User> + Send + 'async>>
60-
where
61-
Self: Sync + 'async,
62-
{
63-
unimplemented!()
64-
}
65-
}
66-
```
45+
(`Pin<Box<dyn Future + Send + 'async>>`).
6746

6847
Note that using these trait methods will result in a heap allocation per-function-call. This is not
6948
a significant cost for the vast majority of applications, but should be considered when deciding

0 commit comments

Comments
 (0)