Rename CoroutineKind::Gen to ::Coroutine

This commit is contained in:
Oli Scherer
2023-10-20 09:02:22 +00:00
parent e96ce20b34
commit 2d91c76d5d
14 changed files with 29 additions and 25 deletions

View File

@@ -2409,7 +2409,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
let message = outer_coroutine
.and_then(|coroutine_did| {
Some(match self.tcx.coroutine_kind(coroutine_did).unwrap() {
CoroutineKind::Gen => format!("coroutine is not {trait_name}"),
CoroutineKind::Coroutine => format!("coroutine is not {trait_name}"),
CoroutineKind::Async(AsyncCoroutineKind::Fn) => self
.tcx
.parent(coroutine_did)
@@ -2882,7 +2882,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
}
ObligationCauseCode::SizedCoroutineInterior(coroutine_def_id) => {
let what = match self.tcx.coroutine_kind(coroutine_def_id) {
None | Some(hir::CoroutineKind::Gen) => "yield",
None | Some(hir::CoroutineKind::Coroutine) => "yield",
Some(hir::CoroutineKind::Async(..)) => "await",
};
err.note(format!(

View File

@@ -1615,7 +1615,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
fn describe_coroutine(&self, body_id: hir::BodyId) -> Option<&'static str> {
self.tcx.hir().body(body_id).coroutine_kind.map(|gen_kind| match gen_kind {
hir::CoroutineKind::Gen => "a coroutine",
hir::CoroutineKind::Coroutine => "a coroutine",
hir::CoroutineKind::Async(hir::AsyncCoroutineKind::Block) => "an async block",
hir::CoroutineKind::Async(hir::AsyncCoroutineKind::Fn) => "an async function",
hir::CoroutineKind::Async(hir::AsyncCoroutineKind::Closure) => "an async closure",