Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita03ba7f

Browse files
Add lang item for AsyncFnKindHelper::Upvars
1 parenta9c7e02 commita03ba7f

File tree

5 files changed

+10
-26
lines changed

5 files changed

+10
-26
lines changed

‎compiler/rustc_hir/src/lang_items.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,11 @@ language_item_table! {
228228
AsyncFn, sym::async_fn, async_fn_trait,Target::Trait,GenericRequirement::Exact(1);
229229
AsyncFnMut, sym::async_fn_mut, async_fn_mut_trait,Target::Trait,GenericRequirement::Exact(1);
230230
AsyncFnOnce, sym::async_fn_once, async_fn_once_trait,Target::Trait,GenericRequirement::Exact(1);
231-
AsyncFnOnceOutput, sym::async_fn_once_output,async_fn_once_output,Target::AssocTy,GenericRequirement::Exact(1);
231+
AsyncFnOnceOutput, sym::async_fn_once_output,async_fn_once_output,Target::AssocTy,GenericRequirement::Exact(1);
232232
CallOnceFuture, sym::call_once_future, call_once_future,Target::AssocTy,GenericRequirement::Exact(1);
233233
CallRefFuture, sym::call_ref_future, call_ref_future,Target::AssocTy,GenericRequirement::Exact(2);
234-
AsyncFnKindHelper, sym::async_fn_kind_helper,async_fn_kind_helper,Target::Trait,GenericRequirement::Exact(1);
234+
AsyncFnKindHelper, sym::async_fn_kind_helper, async_fn_kind_helper,Target::Trait,GenericRequirement::Exact(1);
235+
AsyncFnKindUpvars, sym::async_fn_kind_upvars, async_fn_kind_upvars,Target::AssocTy,GenericRequirement::Exact(5);
235236

236237
FnOnceOutput, sym::fn_once_output, fn_once_output,Target::AssocTy,GenericRequirement::None;
237238

‎compiler/rustc_span/src/symbol.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ symbols! {
438438
async_fn,
439439
async_fn_in_trait,
440440
async_fn_kind_helper,
441+
async_fn_kind_upvars,
441442
async_fn_mut,
442443
async_fn_once,
443444
async_fn_once_output,

‎compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_macros::{TypeFoldable, TypeVisitable};
99
use rustc_middle::bug;
1010
use rustc_middle::traits::solve::Goal;
1111
use rustc_middle::ty::{self,Ty,TyCtxt,TypeFoldable,TypeFolder,TypeSuperFoldable,Upcast};
12-
use rustc_span::sym;
1312

1413
usecrate::solve::EvalCtxt;
1514

@@ -582,13 +581,7 @@ fn coroutine_closure_to_ambiguous_coroutine<'tcx>(
582581
args: ty::CoroutineClosureArgs<'tcx>,
583582
sig: ty::CoroutineClosureSignature<'tcx>,
584583
) ->Ty<'tcx>{
585-
let async_fn_kind_trait_def_id = tcx.require_lang_item(LangItem::AsyncFnKindHelper,None);
586-
let upvars_projection_def_id = tcx
587-
.associated_items(async_fn_kind_trait_def_id)
588-
.filter_by_name_unhygienic(sym::Upvars)
589-
.next()
590-
.unwrap()
591-
.def_id;
584+
let upvars_projection_def_id = tcx.require_lang_item(LangItem::AsyncFnKindUpvars,None);
592585
let tupled_upvars_ty =Ty::new_projection(
593586
tcx,
594587
upvars_projection_def_id,

‎compiler/rustc_trait_selection/src/traits/project.rs‎

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,14 +1680,8 @@ fn confirm_closure_candidate<'cx, 'tcx>(
16801680
args.coroutine_captures_by_ref_ty(),
16811681
)
16821682
}else{
1683-
let async_fn_kind_trait_def_id =
1684-
tcx.require_lang_item(LangItem::AsyncFnKindHelper,None);
1685-
let upvars_projection_def_id = tcx
1686-
.associated_items(async_fn_kind_trait_def_id)
1687-
.filter_by_name_unhygienic(sym::Upvars)
1688-
.next()
1689-
.unwrap()
1690-
.def_id;
1683+
let upvars_projection_def_id =
1684+
tcx.require_lang_item(LangItem::AsyncFnKindUpvars,None);
16911685
let tupled_upvars_ty =Ty::new_projection(
16921686
tcx,
16931687
upvars_projection_def_id,
@@ -1816,14 +1810,8 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
18161810
args.coroutine_captures_by_ref_ty(),
18171811
)
18181812
}else{
1819-
let async_fn_kind_trait_def_id =
1820-
tcx.require_lang_item(LangItem::AsyncFnKindHelper,None);
1821-
let upvars_projection_def_id = tcx
1822-
.associated_items(async_fn_kind_trait_def_id)
1823-
.filter_by_name_unhygienic(sym::Upvars)
1824-
.next()
1825-
.unwrap()
1826-
.def_id;
1813+
let upvars_projection_def_id =
1814+
tcx.require_lang_item(LangItem::AsyncFnKindUpvars,None);
18271815
// When we don't know the closure kind (and therefore also the closure's upvars,
18281816
// which are computed at the same time), we must delay the computation of the
18291817
// generator's upvars. We do this using the `AsyncFnKindHelper`, which as a trait

‎library/core/src/ops/async_function.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ mod internal_implementation_detail {
146146
// `for<'env> fn() -> (&'env T, ...)`. This allows us to represent the binder
147147
// of the closure's self-capture, and these upvar types will be instantiated with
148148
// the `'closure_env` region provided to the associated type.
149+
#[cfg_attr(not(bootstrap), lang ="async_fn_kind_upvars")]
149150
typeUpvars<'closure_env,Inputs,Upvars,BorrowedUpvarsAsFnPtr>;
150151
}
151152
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp