Skip to content
/ rust Public
forked from rust-lang/rust

Commit

Permalink
Auto merge of rust-lang#132611 - compiler-errors:async-prelude, r=ibr…
Browse files Browse the repository at this point in the history
…aheemdev

Add `AsyncFn*` to the prelude in all editions

The general vibe is that we will most likely stabilize the `feature(async_closure)` *without* the `async Fn()` trait bound modifier.

Without `async Fn()` bound syntax, this necessitates users to spell the bound like `AsyncFn()`. Since `core::ops::AsyncFn` is not in the prelude, users will need to import these any time they actually want to use the trait. This seems annoying, so let's add these traits to the prelude unstably.

We're trying to work on the general vision of `async` trait bound modifier in general in: rust-lang/rfcs#3710, however that RFC still needs more time for consensus to converge, and we've decided that the value that users get from calling the bound `async Fn()` is *not really* worth blocking landing async closures in general.
  • Loading branch information
bors committed Nov 24, 2024
2 parents 124eb96 + 98b6e01 commit 4e4c20d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/std/src/prelude/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub use crate::marker::{Send, Sized, Sync, Unpin};
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use crate::ops::{Drop, Fn, FnMut, FnOnce};
#[unstable(feature = "async_closure", issue = "62290")]
#[doc(no_inline)]
pub use crate::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce};

// Re-exported functions
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down

0 comments on commit 4e4c20d

Please sign in to comment.