about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-04-19 22:00:06 +0200
committerGitHub <noreply@github.com>2021-04-19 22:00:06 +0200
commite5b5745db14d852df8996d5f5ed53942f396bbd4 (patch)
treed6fb6fd82a8db78768279a9c71f7d2f51a595c7d /src/test
parent3b81ea86fb4b0dc7bc3e9b9de94409af37baa730 (diff)
parenta54d5759b67d79eb060dca46e851ff01a5cb9801 (diff)
downloadrust-e5b5745db14d852df8996d5f5ed53942f396bbd4.tar.gz
rust-e5b5745db14d852df8996d5f5ed53942f396bbd4.zip
Rollup merge of #84168 - cjgillot:asi, r=davidtwco
Lower async fn in traits.

An error is already created by AST validation.

Fixes #84149
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/async-await/async-trait-fn.rs4
-rw-r--r--src/test/ui/async-await/async-trait-fn.stderr18
2 files changed, 21 insertions, 1 deletions
diff --git a/src/test/ui/async-await/async-trait-fn.rs b/src/test/ui/async-await/async-trait-fn.rs
index f0403b76620..e2062e82725 100644
--- a/src/test/ui/async-await/async-trait-fn.rs
+++ b/src/test/ui/async-await/async-trait-fn.rs
@@ -2,6 +2,10 @@
 trait T {
     async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
     async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`
+    async fn baz() { //~ ERROR functions in traits cannot be declared `async`
+        // Nested item must not ICE.
+        fn a() {}
+    }
 }
 
 fn main() {}
diff --git a/src/test/ui/async-await/async-trait-fn.stderr b/src/test/ui/async-await/async-trait-fn.stderr
index 6080b2815ee..1eb8969a80d 100644
--- a/src/test/ui/async-await/async-trait-fn.stderr
+++ b/src/test/ui/async-await/async-trait-fn.stderr
@@ -20,6 +20,22 @@ 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
+error[E0706]: functions in traits cannot be declared `async`
+  --> $DIR/async-trait-fn.rs:5:5
+   |
+LL |       async fn baz() {
+   |       ^----
+   |       |
+   |  _____`async` because of this
+   | |
+LL | |         // Nested item must not ICE.
+LL | |         fn a() {}
+LL | |     }
+   | |_____^
+   |
+   = 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 3 previous errors
 
 For more information about this error, try `rustc --explain E0706`.