about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-11-18 12:08:03 -0800
committerEsteban Küber <esteban@kuber.com.ar>2019-11-18 12:30:21 -0800
commita7678779a168d7b49cc22b073c8b68feb6d02d99 (patch)
tree88c2365d7c51372480e831600bb03c8472fc21d3
parentaae76304f98e4830c405b2ae16821ddcdf03c2b9 (diff)
downloadrust-a7678779a168d7b49cc22b073c8b68feb6d02d99.tar.gz
rust-a7678779a168d7b49cc22b073c8b68feb6d02d99.zip
Reword help and add test
-rw-r--r--src/librustc_passes/ast_validation.rs10
-rw-r--r--src/test/ui/async-await/async-trait-fn.rs7
-rw-r--r--src/test/ui/async-await/async-trait-fn.stderr20
-rw-r--r--src/test/ui/async-await/edition-deny-async-fns-2015.stderr3
4 files changed, 34 insertions, 6 deletions
diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs
index b7ec2893bb3..c4032ec5dd0 100644
--- a/src/librustc_passes/ast_validation.rs
+++ b/src/librustc_passes/ast_validation.rs
@@ -173,12 +173,10 @@ impl<'a> AstValidator<'a> {
 
     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();
         }
     }
diff --git a/src/test/ui/async-await/async-trait-fn.rs b/src/test/ui/async-await/async-trait-fn.rs
new file mode 100644
index 00000000000..786100e916d
--- /dev/null
+++ b/src/test/ui/async-await/async-trait-fn.rs
@@ -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() {}
diff --git a/src/test/ui/async-await/async-trait-fn.stderr b/src/test/ui/async-await/async-trait-fn.stderr
new file mode 100644
index 00000000000..fb6e0c57d6a
--- /dev/null
+++ b/src/test/ui/async-await/async-trait-fn.stderr
@@ -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
+
diff --git a/src/test/ui/async-await/edition-deny-async-fns-2015.stderr b/src/test/ui/async-await/edition-deny-async-fns-2015.stderr
index 7633825eb32..dc1c891c591 100644
--- a/src/test/ui/async-await/edition-deny-async-fns-2015.stderr
+++ b/src/test/ui/async-await/edition-deny-async-fns-2015.stderr
@@ -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