Reword help and add test

This commit is contained in:
Esteban Küber 2019-11-18 12:08:03 -08:00
parent aae76304f9
commit a7678779a1
4 changed files with 34 additions and 6 deletions

View file

@ -173,12 +173,10 @@ fn check_decl_no_pat<F: FnMut(Span, bool)>(decl: &FnDecl, mut report_err: F) {
fn check_trait_fn_not_async(&self, span: Span, asyncness: IsAsync) {
if asyncness.is_async() {
struct_span_err!(self.session, span, E0706,
"trait fns cannot be declared `async`")
.note("Due to technical restrictions rust does not currently support `async` \
trait fns.")
.note("Consider using the `async-trait` crate in the meantime until further \
notice.")
struct_span_err!(self.session, span, E0706, "trait fns cannot be declared `async`")
.note("`async` trait functions are not currently supported")
.note("consider using the `async-trait` crate: \
https://crates.io/crates/async-trait")
.emit();
}
}

View file

@ -0,0 +1,7 @@
// edition:2018
trait T {
async fn foo() {} //~ ERROR trait fns cannot be declared `async`
async fn bar(&self) {} //~ ERROR trait fns cannot be declared `async`
}
fn main() {}

View file

@ -0,0 +1,20 @@
error[E0706]: trait fns cannot be declared `async`
--> $DIR/async-trait-fn.rs:3:5
|
LL | async fn foo() {}
| ^^^^^^^^^^^^^^^^^
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
error[E0706]: trait fns cannot be declared `async`
--> $DIR/async-trait-fn.rs:4:5
|
LL | async fn bar(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
error: aborting due to 2 previous errors

View file

@ -57,6 +57,9 @@ error[E0706]: trait fns cannot be declared `async`
|
LL | async fn foo() {}
| ^^^^^^^^^^^^^^^^^
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
error: aborting due to 10 previous errors