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

@ -2821,7 +2821,7 @@ impl<'tcx> ObligationCauseExt<'tcx> for ObligationCause<'tcx> {
// say, also take a look at the error code, maybe we can
// tailor to that.
_ => match terr {
TypeError::CyclicTy(ty) if ty.is_closure() || ty.is_generator() => Error0644,
TypeError::CyclicTy(ty) if ty.is_closure() || ty.is_coroutine() => Error0644,
TypeError::IntrinsicCast => Error0308,
_ => Error0308,
},
@ -2868,7 +2868,7 @@ impl<'tcx> ObligationCauseExt<'tcx> for ObligationCause<'tcx> {
// say, also take a look at the error code, maybe we can
// tailor to that.
_ => match terr {
TypeError::CyclicTy(ty) if ty.is_closure() || ty.is_generator() => {
TypeError::CyclicTy(ty) if ty.is_closure() || ty.is_coroutine() => {
ObligationCauseFailureCode::ClosureSelfref { span }
}
TypeError::IntrinsicCast => {
@ -2960,7 +2960,7 @@ impl TyCategory {
Some((kind, def_id))
}
ty::Coroutine(def_id, ..) => {
Some((Self::Coroutine(tcx.generator_kind(def_id).unwrap()), def_id))
Some((Self::Coroutine(tcx.coroutine_kind(def_id).unwrap()), def_id))
}
ty::Foreign(def_id) => Some((Self::Foreign, def_id)),
_ => None,

View file

@ -868,7 +868,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
) {
// Opaque types can't be named by the user right now.
//
// Both the generic arguments of closures and generators can
// Both the generic arguments of closures and coroutines can
// also not be named. We may want to only look into the closure
// signature in case it has no captures, as that can be represented
// using `fn(T) -> R`.

View file

@ -325,7 +325,7 @@ impl<T> Trait<T> for X {
}
CyclicTy(ty) => {
// Watch out for various cases of cyclic types and try to explain.
if ty.is_closure() || ty.is_generator() {
if ty.is_closure() || ty.is_coroutine() {
diag.note(
"closures cannot capture themselves or take themselves as argument;\n\
this error may be the result of a recent compiler bug-fix,\n\

View file

@ -458,12 +458,12 @@ where
// Skip lifetime parameters of the enclosing item(s)
// Also skip the witness type, because that has no free regions.
for upvar in args.as_generator().upvar_tys() {
for upvar in args.as_coroutine().upvar_tys() {
upvar.visit_with(self);
}
args.as_generator().return_ty().visit_with(self);
args.as_generator().yield_ty().visit_with(self);
args.as_generator().resume_ty().visit_with(self);
args.as_coroutine().return_ty().visit_with(self);
args.as_coroutine().yield_ty().visit_with(self);
args.as_coroutine().resume_ty().visit_with(self);
}
ty::Alias(ty::Opaque, ty::AliasTy { def_id, ref args, .. }) => {

View file

@ -104,10 +104,10 @@ fn compute_components<'tcx>(
ty::Coroutine(_, ref args, _) => {
// Same as the closure case
let tupled_ty = args.as_generator().tupled_upvars_ty();
let tupled_ty = args.as_coroutine().tupled_upvars_ty();
compute_components(tcx, tupled_ty, out, visited);
// We ignore regions in the generator interior as we don't
// We ignore regions in the coroutine interior as we don't
// want these to affect region inference
}