about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-11-04 19:29:02 +0000
committerMichael Goulet <michael@errs.io>2024-12-02 16:50:44 +0000
commit59e3e8934e3e50ddb9b9a9ffaa523cbab2260598 (patch)
treed2883e386337ef32de1647da6f538739f1a40f30
parenta6f2f00de89e1dd9cb903db93dac754398c1267f (diff)
downloadrust-59e3e8934e3e50ddb9b9a9ffaa523cbab2260598.tar.gz
rust-59e3e8934e3e50ddb9b9a9ffaa523cbab2260598.zip
Gate async fn trait bound modifier on async_trait_bounds
-rw-r--r--compiler/rustc_ast_passes/src/feature_gate.rs5
-rw-r--r--compiler/rustc_feature/src/unstable.rs2
-rw-r--r--compiler/rustc_parse/src/parser/ty.rs4
-rw-r--r--compiler/rustc_span/src/symbol.rs1
-rw-r--r--src/tools/miri/tests/pass/async-closure-captures.rs2
-rw-r--r--src/tools/miri/tests/pass/async-closure-drop.rs2
-rw-r--r--tests/codegen/async-closure-debug.rs2
-rw-r--r--tests/coverage/async_closure.cov-map8
-rw-r--r--tests/coverage/async_closure.coverage2
-rw-r--r--tests/coverage/async_closure.rs2
-rw-r--r--tests/crashes/124020.rs4
-rw-r--r--tests/ui/async-await/async-fn/dyn-pos.rs2
-rw-r--r--tests/ui/async-await/async-fn/dyn-pos.stderr4
-rw-r--r--tests/ui/async-await/async-fn/edition-2015.rs4
-rw-r--r--tests/ui/async-await/async-fn/edition-2015.stderr12
-rw-r--r--tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.rs4
-rw-r--r--tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.stderr12
-rw-r--r--tests/ui/async-await/async-fn/not-a-trait.rs2
-rw-r--r--tests/ui/async-await/async-fn/sugar.rs2
-rw-r--r--tests/ui/async-await/async-fn/trait-bounds-in-macro.rs2
-rw-r--r--tests/ui/async-await/async-fn/trait-bounds-in-macro.stderr6
-rw-r--r--tests/ui/async-await/async-fn/wrong-trait.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-async-trait-bounds.rs7
-rw-r--r--tests/ui/feature-gates/feature-gate-async-trait-bounds.stderr24
-rw-r--r--tests/ui/impl-trait/precise-capturing/bound-modifiers.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr6
-rw-r--r--tests/ui/parser/bad-recover-kw-after-impl.rs2
-rw-r--r--tests/ui/parser/bad-recover-kw-after-impl.stderr6
28 files changed, 86 insertions, 47 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs
index 8cdc7133cc0..0c925cd8fa2 100644
--- a/compiler/rustc_ast_passes/src/feature_gate.rs
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs
@@ -516,6 +516,11 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
         "async closures are unstable",
         "to use an async block, remove the `||`: `async {`"
     );
+    gate_all!(
+        async_trait_bounds,
+        "`async` trait bounds are unstable",
+        "use the desugared name of the async trait, such as `AsyncFn`"
+    );
     gate_all!(async_for_loop, "`for await` loops are experimental");
     gate_all!(
         closure_lifetime_binder,
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index ec908762da7..cb6bc03f9e2 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -394,6 +394,8 @@ declare_features! (
     (unstable, async_fn_track_caller, "1.73.0", Some(110011)),
     /// Allows `for await` loops.
     (unstable, async_for_loop, "1.77.0", Some(118898)),
+    /// Allows `async` trait bound modifier.
+    (unstable, async_trait_bounds, "CURRENT_RUSTC_VERSION", Some(62290)),
     /// Allows using C-variadics.
     (unstable, c_variadic, "1.34.0", Some(44930)),
     /// Allows the use of `#[cfg(<true/false>)]`.
diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs
index 505586e74f1..1340558d968 100644
--- a/compiler/rustc_parse/src/parser/ty.rs
+++ b/compiler/rustc_parse/src/parser/ty.rs
@@ -940,7 +940,7 @@ impl<'a> Parser<'a> {
         let asyncness = if self.token.uninterpolated_span().at_least_rust_2018()
             && self.eat_keyword(kw::Async)
         {
-            self.psess.gated_spans.gate(sym::async_closure, self.prev_token.span);
+            self.psess.gated_spans.gate(sym::async_trait_bounds, self.prev_token.span);
             BoundAsyncness::Async(self.prev_token.span)
         } else if self.may_recover()
             && self.token.uninterpolated_span().is_rust_2015()
@@ -951,7 +951,7 @@ impl<'a> Parser<'a> {
                 span: self.prev_token.span,
                 help: HelpUseLatestEdition::new(),
             });
-            self.psess.gated_spans.gate(sym::async_closure, self.prev_token.span);
+            self.psess.gated_spans.gate(sym::async_trait_bounds, self.prev_token.span);
             BoundAsyncness::Async(self.prev_token.span)
         } else {
             BoundAsyncness::Normal
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index e94c0a5ea6e..b2ca86bf486 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -468,6 +468,7 @@ symbols! {
         async_for_loop,
         async_iterator,
         async_iterator_poll_next,
+        async_trait_bounds,
         atomic,
         atomic_mod,
         atomics,
diff --git a/src/tools/miri/tests/pass/async-closure-captures.rs b/src/tools/miri/tests/pass/async-closure-captures.rs
index cac26bfe146..423ef7a5cf7 100644
--- a/src/tools/miri/tests/pass/async-closure-captures.rs
+++ b/src/tools/miri/tests/pass/async-closure-captures.rs
@@ -1,6 +1,6 @@
 // Same as rustc's `tests/ui/async-await/async-closures/captures.rs`, keep in sync
 
-#![feature(async_closure, noop_waker)]
+#![feature(async_closure, noop_waker, async_trait_bounds)]
 
 use std::future::Future;
 use std::pin::pin;
diff --git a/src/tools/miri/tests/pass/async-closure-drop.rs b/src/tools/miri/tests/pass/async-closure-drop.rs
index 9b2fc2948bf..264da5a9518 100644
--- a/src/tools/miri/tests/pass/async-closure-drop.rs
+++ b/src/tools/miri/tests/pass/async-closure-drop.rs
@@ -1,4 +1,4 @@
-#![feature(async_closure, noop_waker, async_fn_traits)]
+#![feature(async_closure, noop_waker, async_trait_bounds)]
 
 use std::future::Future;
 use std::pin::pin;
diff --git a/tests/codegen/async-closure-debug.rs b/tests/codegen/async-closure-debug.rs
index 9cb1e623295..644df169a36 100644
--- a/tests/codegen/async-closure-debug.rs
+++ b/tests/codegen/async-closure-debug.rs
@@ -9,7 +9,7 @@
 
 #![feature(async_closure)]
 
-fn async_closure_test(upvar: &str) -> impl async Fn() + '_ {
+fn async_closure_test(upvar: &str) -> impl AsyncFn() + '_ {
     async move || {
         let hello = String::from("hello");
         println!("{hello}, {upvar}");
diff --git a/tests/coverage/async_closure.cov-map b/tests/coverage/async_closure.cov-map
index 4d00f0d9b33..9ff29af8e8e 100644
--- a/tests/coverage/async_closure.cov-map
+++ b/tests/coverage/async_closure.cov-map
@@ -1,19 +1,19 @@
 Function name: async_closure::call_once::<async_closure::main::{closure#0}>
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 07, 01, 00, 2c]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 07, 01, 00, 2b]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 0
 Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 44)
+- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 43)
 Highest counter ID seen: c0
 
 Function name: async_closure::call_once::<async_closure::main::{closure#0}>::{closure#0}
-Raw bytes (14): 0x[01, 01, 00, 02, 01, 07, 2c, 01, 0e, 05, 02, 01, 00, 02]
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 07, 2b, 01, 0e, 05, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 0
 Number of file 0 mappings: 2
-- Code(Counter(0)) at (prev + 7, 44) to (start + 1, 14)
+- Code(Counter(0)) at (prev + 7, 43) to (start + 1, 14)
 - Code(Counter(1)) at (prev + 2, 1) to (start + 0, 2)
 Highest counter ID seen: c1
 
diff --git a/tests/coverage/async_closure.coverage b/tests/coverage/async_closure.coverage
index fd6edf7c29e..75da1a01fc1 100644
--- a/tests/coverage/async_closure.coverage
+++ b/tests/coverage/async_closure.coverage
@@ -4,7 +4,7 @@
    LL|       |//@ aux-build: executor.rs
    LL|       |extern crate executor;
    LL|       |
-   LL|      1|async fn call_once(f: impl async FnOnce()) {
+   LL|      1|async fn call_once(f: impl AsyncFnOnce()) {
    LL|      1|    f().await;
    LL|      1|}
    LL|       |
diff --git a/tests/coverage/async_closure.rs b/tests/coverage/async_closure.rs
index c076d03eef4..cbac592d957 100644
--- a/tests/coverage/async_closure.rs
+++ b/tests/coverage/async_closure.rs
@@ -4,7 +4,7 @@
 //@ aux-build: executor.rs
 extern crate executor;
 
-async fn call_once(f: impl async FnOnce()) {
+async fn call_once(f: impl AsyncFnOnce()) {
     f().await;
 }
 
diff --git a/tests/crashes/124020.rs b/tests/crashes/124020.rs
index f461f32f59d..1b875497465 100644
--- a/tests/crashes/124020.rs
+++ b/tests/crashes/124020.rs
@@ -1,7 +1,7 @@
 //@ known-bug: #124020
 //@ compile-flags: -Zpolymorphize=on --edition=2018 --crate-type=lib
 
-#![feature(async_closure, noop_waker, async_fn_traits)]
+#![feature(async_closure, noop_waker, async_trait_bounds)]
 
 use std::future::Future;
 use std::pin::pin;
@@ -19,7 +19,7 @@ pub fn block_on<T>(fut: impl Future<Output = T>) -> T {
     }
 }
 
-async fn call_once(f: impl async FnOnce(DropMe)) {
+async fn call_once(f: impl AsyncFnOnce(DropMe)) {
     f(DropMe("world")).await;
 }
 
diff --git a/tests/ui/async-await/async-fn/dyn-pos.rs b/tests/ui/async-await/async-fn/dyn-pos.rs
index a16b7c26f0d..129ea282936 100644
--- a/tests/ui/async-await/async-fn/dyn-pos.rs
+++ b/tests/ui/async-await/async-fn/dyn-pos.rs
@@ -2,7 +2,7 @@
 
 #![feature(async_closure)]
 
-fn foo(x: &dyn async Fn()) {}
+fn foo(x: &dyn AsyncFn()) {}
 //~^ ERROR the trait `AsyncFnMut` cannot be made into an object
 
 fn main() {}
diff --git a/tests/ui/async-await/async-fn/dyn-pos.stderr b/tests/ui/async-await/async-fn/dyn-pos.stderr
index a9abfc5e5c4..aaa8eb2634d 100644
--- a/tests/ui/async-await/async-fn/dyn-pos.stderr
+++ b/tests/ui/async-await/async-fn/dyn-pos.stderr
@@ -1,8 +1,8 @@
 error[E0038]: the trait `AsyncFnMut` cannot be made into an object
   --> $DIR/dyn-pos.rs:5:16
    |
-LL | fn foo(x: &dyn async Fn()) {}
-   |                ^^^^^^^^^^ `AsyncFnMut` cannot be made into an object
+LL | fn foo(x: &dyn AsyncFn()) {}
+   |                ^^^^^^^^^ `AsyncFnMut` cannot be made into an object
    |
 note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
   --> $SRC_DIR/core/src/ops/async_function.rs:LL:COL
diff --git a/tests/ui/async-await/async-fn/edition-2015.rs b/tests/ui/async-await/async-fn/edition-2015.rs
index e38179758f6..7fc62a8dd93 100644
--- a/tests/ui/async-await/async-fn/edition-2015.rs
+++ b/tests/ui/async-await/async-fn/edition-2015.rs
@@ -1,8 +1,8 @@
 fn foo(x: impl async Fn()) -> impl async Fn() { x }
 //~^ ERROR `async` trait bounds are only allowed in Rust 2018 or later
 //~| ERROR `async` trait bounds are only allowed in Rust 2018 or later
-//~| ERROR async closures are unstable
-//~| ERROR async closures are unstable
+//~| ERROR `async` trait bounds are unstable
+//~| ERROR `async` trait bounds are unstable
 //~| ERROR use of unstable library feature `async_closure`
 //~| ERROR use of unstable library feature `async_closure`
 
diff --git a/tests/ui/async-await/async-fn/edition-2015.stderr b/tests/ui/async-await/async-fn/edition-2015.stderr
index 9fbceafd75d..96fb4c9e979 100644
--- a/tests/ui/async-await/async-fn/edition-2015.stderr
+++ b/tests/ui/async-await/async-fn/edition-2015.stderr
@@ -16,27 +16,27 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
    = help: pass `--edition 2024` to `rustc`
    = note: for more on editions, read https://doc.rust-lang.org/edition-guide
 
-error[E0658]: async closures are unstable
+error[E0658]: `async` trait bounds are unstable
   --> $DIR/edition-2015.rs:1:16
    |
 LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
    |                ^^^^^
    |
    = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
-   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = help: add `#![feature(async_trait_bounds)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-   = help: to use an async block, remove the `||`: `async {`
+   = help: use the desugared name of the async trait, such as `AsyncFn`
 
-error[E0658]: async closures are unstable
+error[E0658]: `async` trait bounds are unstable
   --> $DIR/edition-2015.rs:1:36
    |
 LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
    |                                    ^^^^^
    |
    = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
-   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = help: add `#![feature(async_trait_bounds)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-   = help: to use an async block, remove the `||`: `async {`
+   = help: use the desugared name of the async trait, such as `AsyncFn`
 
 error[E0658]: use of unstable library feature `async_closure`
   --> $DIR/edition-2015.rs:1:42
diff --git a/tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.rs b/tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.rs
index abc429772fd..ea67831b68e 100644
--- a/tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.rs
+++ b/tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.rs
@@ -13,9 +13,9 @@ macro_rules! demo {
 }
 
 demo! { impl async Trait }
-//~^ ERROR async closures are unstable
+//~^ ERROR `async` trait bounds are unstable
 
 demo! { dyn async Trait }
-//~^ ERROR async closures are unstable
+//~^ ERROR `async` trait bounds are unstable
 
 fn main() {}
diff --git a/tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.stderr b/tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.stderr
index 13b8e72b49d..a463944d113 100644
--- a/tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.stderr
+++ b/tests/ui/async-await/async-fn/mbe-async-trait-bound-theoretical-regression.stderr
@@ -20,27 +20,27 @@ LL | demo! { dyn async Trait }
    |
    = note: this error originates in the macro `demo` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0658]: async closures are unstable
+error[E0658]: `async` trait bounds are unstable
   --> $DIR/mbe-async-trait-bound-theoretical-regression.rs:15:14
    |
 LL | demo! { impl async Trait }
    |              ^^^^^
    |
    = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
-   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = help: add `#![feature(async_trait_bounds)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-   = help: to use an async block, remove the `||`: `async {`
+   = help: use the desugared name of the async trait, such as `AsyncFn`
 
-error[E0658]: async closures are unstable
+error[E0658]: `async` trait bounds are unstable
   --> $DIR/mbe-async-trait-bound-theoretical-regression.rs:18:13
    |
 LL | demo! { dyn async Trait }
    |             ^^^^^
    |
    = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
-   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = help: add `#![feature(async_trait_bounds)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-   = help: to use an async block, remove the `||`: `async {`
+   = help: use the desugared name of the async trait, such as `AsyncFn`
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/async-await/async-fn/not-a-trait.rs b/tests/ui/async-await/async-fn/not-a-trait.rs
index 0d22cbd2c07..5cf23f2456a 100644
--- a/tests/ui/async-await/async-fn/not-a-trait.rs
+++ b/tests/ui/async-await/async-fn/not-a-trait.rs
@@ -1,6 +1,6 @@
 //@ edition:2018
 
-#![feature(async_closure)]
+#![feature(async_trait_bounds)]
 
 struct S;
 
diff --git a/tests/ui/async-await/async-fn/sugar.rs b/tests/ui/async-await/async-fn/sugar.rs
index 29b6abc814a..0225b666ac5 100644
--- a/tests/ui/async-await/async-fn/sugar.rs
+++ b/tests/ui/async-await/async-fn/sugar.rs
@@ -1,7 +1,7 @@
 //@ edition: 2021
 //@ check-pass
 
-#![feature(async_closure)]
+#![feature(async_closure, async_trait_bounds)]
 
 async fn foo() {}
 
diff --git a/tests/ui/async-await/async-fn/trait-bounds-in-macro.rs b/tests/ui/async-await/async-fn/trait-bounds-in-macro.rs
index 329a1528e8b..654883966f4 100644
--- a/tests/ui/async-await/async-fn/trait-bounds-in-macro.rs
+++ b/tests/ui/async-await/async-fn/trait-bounds-in-macro.rs
@@ -6,7 +6,7 @@ macro_rules! x {
 
 x! {
     async fn foo() -> impl async Fn() { }
-    //~^ ERROR async closures are unstable
+    //~^ ERROR `async` trait bounds are unstable
 }
 
 fn main() {}
diff --git a/tests/ui/async-await/async-fn/trait-bounds-in-macro.stderr b/tests/ui/async-await/async-fn/trait-bounds-in-macro.stderr
index f68c09737db..259e13cd1fe 100644
--- a/tests/ui/async-await/async-fn/trait-bounds-in-macro.stderr
+++ b/tests/ui/async-await/async-fn/trait-bounds-in-macro.stderr
@@ -1,13 +1,13 @@
-error[E0658]: async closures are unstable
+error[E0658]: `async` trait bounds are unstable
   --> $DIR/trait-bounds-in-macro.rs:8:28
    |
 LL |     async fn foo() -> impl async Fn() { }
    |                            ^^^^^
    |
    = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
-   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = help: add `#![feature(async_trait_bounds)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-   = help: to use an async block, remove the `||`: `async {`
+   = help: use the desugared name of the async trait, such as `AsyncFn`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/async-await/async-fn/wrong-trait.rs b/tests/ui/async-await/async-fn/wrong-trait.rs
index e6fb0b46712..38d6bb1d01a 100644
--- a/tests/ui/async-await/async-fn/wrong-trait.rs
+++ b/tests/ui/async-await/async-fn/wrong-trait.rs
@@ -1,6 +1,6 @@
 //@ edition:2018
 
-#![feature(async_closure)]
+#![feature(async_trait_bounds)]
 
 trait Foo {}
 
diff --git a/tests/ui/feature-gates/feature-gate-async-trait-bounds.rs b/tests/ui/feature-gates/feature-gate-async-trait-bounds.rs
new file mode 100644
index 00000000000..db5d7aa06d2
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-async-trait-bounds.rs
@@ -0,0 +1,7 @@
+//@ edition: 2021
+
+fn test(_: impl async Fn()) {}
+//~^ ERROR `async` trait bounds are unstable
+//~| ERROR use of unstable library feature `async_closure`
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-async-trait-bounds.stderr b/tests/ui/feature-gates/feature-gate-async-trait-bounds.stderr
new file mode 100644
index 00000000000..abc7e37c45f
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-async-trait-bounds.stderr
@@ -0,0 +1,24 @@
+error[E0658]: `async` trait bounds are unstable
+  --> $DIR/feature-gate-async-trait-bounds.rs:3:17
+   |
+LL | fn test(_: impl async Fn()) {}
+   |                 ^^^^^
+   |
+   = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
+   = help: add `#![feature(async_trait_bounds)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+   = help: use the desugared name of the async trait, such as `AsyncFn`
+
+error[E0658]: use of unstable library feature `async_closure`
+  --> $DIR/feature-gate-async-trait-bounds.rs:3:23
+   |
+LL | fn test(_: impl async Fn()) {}
+   |                       ^^^^
+   |
+   = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
+   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs b/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs
index 46121308fa0..cac5ae177d2 100644
--- a/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs
+++ b/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs
@@ -7,7 +7,7 @@ fn polarity() -> impl Sized + ?use<> {}
 fn asyncness() -> impl Sized + async use<> {}
 //~^ ERROR expected identifier, found keyword `use`
 //~| ERROR cannot find trait `r#use` in this scope
-//~| ERROR async closures are unstable
+//~| ERROR `async` trait bounds are unstable
 
 fn constness() -> impl Sized + const use<> {}
 //~^ ERROR expected identifier, found keyword `use`
diff --git a/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr b/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr
index 16e7470debf..d4b5b47b41b 100644
--- a/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr
+++ b/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr
@@ -46,16 +46,16 @@ error[E0405]: cannot find trait `r#use` in this scope
 LL | fn binder() -> impl Sized + for<'a> use<> {}
    |                                     ^^^ not found in this scope
 
-error[E0658]: async closures are unstable
+error[E0658]: `async` trait bounds are unstable
   --> $DIR/bound-modifiers.rs:7:32
    |
 LL | fn asyncness() -> impl Sized + async use<> {}
    |                                ^^^^^
    |
    = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
-   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = help: add `#![feature(async_trait_bounds)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-   = help: to use an async block, remove the `||`: `async {`
+   = help: use the desugared name of the async trait, such as `AsyncFn`
 
 error[E0658]: const trait impls are experimental
   --> $DIR/bound-modifiers.rs:12:32
diff --git a/tests/ui/parser/bad-recover-kw-after-impl.rs b/tests/ui/parser/bad-recover-kw-after-impl.rs
index 15c0b377c8a..964d32c55bc 100644
--- a/tests/ui/parser/bad-recover-kw-after-impl.rs
+++ b/tests/ui/parser/bad-recover-kw-after-impl.rs
@@ -12,6 +12,6 @@ macro_rules! impl_primitive {
 
 impl_primitive!(impl async);
 //~^ ERROR expected identifier, found `<eof>`
-//~| ERROR async closures are unstable
+//~| ERROR `async` trait bounds are unstable
 
 fn main() {}
diff --git a/tests/ui/parser/bad-recover-kw-after-impl.stderr b/tests/ui/parser/bad-recover-kw-after-impl.stderr
index f617cf65498..7a8979db165 100644
--- a/tests/ui/parser/bad-recover-kw-after-impl.stderr
+++ b/tests/ui/parser/bad-recover-kw-after-impl.stderr
@@ -7,16 +7,16 @@ LL |     ($ty:ty) => {
 LL | impl_primitive!(impl async);
    |                      ^^^^^ expected identifier
 
-error[E0658]: async closures are unstable
+error[E0658]: `async` trait bounds are unstable
   --> $DIR/bad-recover-kw-after-impl.rs:13:22
    |
 LL | impl_primitive!(impl async);
    |                      ^^^^^
    |
    = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
-   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = help: add `#![feature(async_trait_bounds)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-   = help: to use an async block, remove the `||`: `async {`
+   = help: use the desugared name of the async trait, such as `AsyncFn`
 
 error: aborting due to 2 previous errors