Skip to content

Commit e935223

Browse files
authored
Rollup merge of rust-lang#125733 - compiler-errors:async-fn-assoc-item, r=fmease
Add lang items for `AsyncFn*`, `Future`, `AsyncFnKindHelper`'s associated types Adds lang items for `AsyncFnOnce::Output`, `AsyncFnOnce::CallOnceFuture`, `AsyncFnMut::CallRefFuture`, and uses them in the new solver. I'm mostly interested in doing this to help accelerate uplifting the new trait solver into a separate crate. The old solver is kind of spaghetti, so I haven't moved that to use these lang items (i.e. it still uses `item_name`-based comparisons). update: Also adds lang items for `Future::Output` and `AsyncFnKindHelper::Upvars`. cc ``@lcnr``
2 parents d82378a + 99eabb4 commit e935223

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/src/future/future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::task::{Context, Poll};
3535
pub trait Future {
3636
/// The type of value produced on completion.
3737
#[stable(feature = "futures_api", since = "1.36.0")]
38-
#[rustc_diagnostic_item = "FutureOutput"]
38+
#[cfg_attr(not(bootstrap), lang = "future_output")]
3939
type Output;
4040

4141
/// Attempt to resolve the future to a final value, registering

core/src/ops/async_function.rs

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub trait AsyncFn<Args: Tuple>: AsyncFnMut<Args> {
2626
pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {
2727
/// Future returned by [`AsyncFnMut::async_call_mut`] and [`AsyncFn::async_call`].
2828
#[unstable(feature = "async_fn_traits", issue = "none")]
29+
#[cfg_attr(not(bootstrap), lang = "call_ref_future")]
2930
type CallRefFuture<'a>: Future<Output = Self::Output>
3031
where
3132
Self: 'a;
@@ -46,10 +47,12 @@ pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {
4647
pub trait AsyncFnOnce<Args: Tuple> {
4748
/// Future returned by [`AsyncFnOnce::async_call_once`].
4849
#[unstable(feature = "async_fn_traits", issue = "none")]
50+
#[cfg_attr(not(bootstrap), lang = "call_once_future")]
4951
type CallOnceFuture: Future<Output = Self::Output>;
5052

5153
/// Output type of the called closure's future.
5254
#[unstable(feature = "async_fn_traits", issue = "none")]
55+
#[cfg_attr(not(bootstrap), lang = "async_fn_once_output")]
5356
type Output;
5457

5558
/// Call the [`AsyncFnOnce`], returning a future which may move out of the called closure.
@@ -143,6 +146,7 @@ mod internal_implementation_detail {
143146
// `for<'env> fn() -> (&'env T, ...)`. This allows us to represent the binder
144147
// of the closure's self-capture, and these upvar types will be instantiated with
145148
// the `'closure_env` region provided to the associated type.
149+
#[cfg_attr(not(bootstrap), lang = "async_fn_kind_upvars")]
146150
type Upvars<'closure_env, Inputs, Upvars, BorrowedUpvarsAsFnPtr>;
147151
}
148152
}

0 commit comments

Comments
 (0)