1
Fork 0

s/generator/coroutine/

This commit is contained in:
Oli Scherer 2023-10-19 21:46:28 +00:00
parent 60956837cf
commit e96ce20b34
468 changed files with 2201 additions and 2197 deletions

View file

@ -2190,20 +2190,20 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
}
ty::Coroutine(_, args, hir::Movability::Movable) => {
if self.tcx().features().generator_clone {
if self.tcx().features().coroutine_clone {
let resolved_upvars =
self.infcx.shallow_resolve(args.as_generator().tupled_upvars_ty());
self.infcx.shallow_resolve(args.as_coroutine().tupled_upvars_ty());
let resolved_witness =
self.infcx.shallow_resolve(args.as_generator().witness());
self.infcx.shallow_resolve(args.as_coroutine().witness());
if resolved_upvars.is_ty_var() || resolved_witness.is_ty_var() {
// Not yet resolved.
Ambiguous
} else {
let all = args
.as_generator()
.as_coroutine()
.upvar_tys()
.iter()
.chain([args.as_generator().witness()])
.chain([args.as_coroutine().witness()])
.collect::<Vec<_>>();
Where(obligation.predicate.rebind(all))
}
@ -2213,7 +2213,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
}
ty::CoroutineWitness(def_id, ref args) => {
let hidden_types = bind_generator_hidden_types_above(
let hidden_types = bind_coroutine_hidden_types_above(
self.infcx,
def_id,
args,
@ -2312,13 +2312,13 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
}
ty::Coroutine(_, ref args, _) => {
let ty = self.infcx.shallow_resolve(args.as_generator().tupled_upvars_ty());
let witness = args.as_generator().witness();
let ty = self.infcx.shallow_resolve(args.as_coroutine().tupled_upvars_ty());
let witness = args.as_coroutine().witness();
t.rebind([ty].into_iter().chain(iter::once(witness)).collect())
}
ty::CoroutineWitness(def_id, ref args) => {
bind_generator_hidden_types_above(self.infcx, def_id, args, t.bound_vars())
bind_coroutine_hidden_types_above(self.infcx, def_id, args, t.bound_vars())
}
// For `PhantomData<T>`, we pass `T`.
@ -3054,12 +3054,12 @@ pub enum ProjectionMatchesProjection {
No,
}
/// Replace all regions inside the generator interior with late bound regions.
/// Replace all regions inside the coroutine interior with late bound regions.
/// Note that each region slot in the types gets a new fresh late bound region, which means that
/// none of the regions inside relate to any other, even if typeck had previously found constraints
/// that would cause them to be related.
#[instrument(level = "trace", skip(infcx), ret)]
fn bind_generator_hidden_types_above<'tcx>(
fn bind_coroutine_hidden_types_above<'tcx>(
infcx: &InferCtxt<'tcx>,
def_id: DefId,
args: ty::GenericArgsRef<'tcx>,
@ -3074,7 +3074,7 @@ fn bind_generator_hidden_types_above<'tcx>(
let mut counter = num_bound_variables;
let hidden_types: Vec<_> = tcx
.generator_hidden_types(def_id)
.coroutine_hidden_types(def_id)
// Deduplicate tys to avoid repeated work.
.filter(|bty| seen_tys.insert(*bty))
.map(|mut bty| {