Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more context when trying to write async trait function #65899

Open
estebank opened this issue Oct 28, 2019 · 2 comments

Comments

@estebank
Copy link
Contributor

@estebank estebank commented Oct 28, 2019

Given

trait T {
    async fn foo() {}
    async fn bar(&self) {}
}

we currently emit

error[E0706]: trait fns cannot be declared `async`
 --> src/lib.rs:2:5
  |
2 |     async fn foo() {}
  |     ^^^^^^^^^^^^^^^^^

error[E0706]: trait fns cannot be declared `async`
 --> src/lib.rs:3:5
  |
3 |     async fn bar(&self) {}
  |     ^^^^^^^^^^^^^^^^^^^^^^

We should tell people that async trait functions are not possible because of technical restrictions, and possibly point them to the async-trait crate.

This issue has been assigned to @jafern14 via this comment.

@estebank estebank closed this Oct 28, 2019
@estebank estebank changed the title Make rustc parse async trait functions and provide targetted error Add more context when trying to write async trait function Oct 28, 2019
@estebank estebank reopened this Oct 28, 2019
@Centril Centril added the E-easy label Oct 28, 2019
@jafern14

This comment has been minimized.

Copy link

@jafern14 jafern14 commented Oct 29, 2019

@rustbot claim

@rustbot rustbot self-assigned this Oct 29, 2019
@jafern14

This comment has been minimized.

Copy link

@jafern14 jafern14 commented Oct 29, 2019

Created #65937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.