]> git.lizzy.rs Git - rust.git/commitdiff
Add test.
authorCamille GILLOT <gillot.camille@gmail.com>
Thu, 15 Apr 2021 19:41:40 +0000 (21:41 +0200)
committerCamille GILLOT <gillot.camille@gmail.com>
Thu, 15 Apr 2021 19:41:45 +0000 (21:41 +0200)
src/test/ui/async-await/async-trait-fn.rs
src/test/ui/async-await/async-trait-fn.stderr

index f0403b76620c1ba076a7c07303783c7b420d141b..e2062e82725c0507fad934ec9f6720dfab28ea71 100644 (file)
@@ -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() {}
index 6080b2815eeb8cd3577aaa74515ff4c3632f066a..1eb8969a80d20047db21c886240c0dc11aebc73d 100644 (file)
@@ -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`.