From a54d5759b67d79eb060dca46e851ff01a5cb9801 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 15 Apr 2021 21:41:40 +0200 Subject: [PATCH] Add test. --- src/test/ui/async-await/async-trait-fn.rs | 4 ++++ src/test/ui/async-await/async-trait-fn.stderr | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) 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`. -- 2.44.0