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

@@ -139,9 +139,9 @@ impl<O> AssertKind<O> {
Overflow(op, _, _) => bug!("{:?} cannot overflow", op),
DivisionByZero(_) => "attempt to divide by zero",
RemainderByZero(_) => "attempt to calculate the remainder with a divisor of zero",
ResumedAfterReturn(CoroutineKind::Gen) => "coroutine resumed after completion",
ResumedAfterReturn(CoroutineKind::Coroutine) => "coroutine resumed after completion",
ResumedAfterReturn(CoroutineKind::Async(_)) => "`async fn` resumed after completion",
ResumedAfterPanic(CoroutineKind::Gen) => "coroutine resumed after panicking",
ResumedAfterPanic(CoroutineKind::Coroutine) => "coroutine resumed after panicking",
ResumedAfterPanic(CoroutineKind::Async(_)) => "`async fn` resumed after panicking",
BoundsCheck { .. } | MisalignedPointerDereference { .. } => {
bug!("Unexpected AssertKind")
@@ -229,9 +229,13 @@ impl<O> AssertKind<O> {
DivisionByZero(_) => middle_assert_divide_by_zero,
RemainderByZero(_) => middle_assert_remainder_by_zero,
ResumedAfterReturn(CoroutineKind::Async(_)) => middle_assert_async_resume_after_return,
ResumedAfterReturn(CoroutineKind::Gen) => middle_assert_coroutine_resume_after_return,
ResumedAfterReturn(CoroutineKind::Coroutine) => {
middle_assert_coroutine_resume_after_return
}
ResumedAfterPanic(CoroutineKind::Async(_)) => middle_assert_async_resume_after_panic,
ResumedAfterPanic(CoroutineKind::Gen) => middle_assert_coroutine_resume_after_panic,
ResumedAfterPanic(CoroutineKind::Coroutine) => {
middle_assert_coroutine_resume_after_panic
}
MisalignedPointerDereference { .. } => middle_assert_misaligned_ptr_deref,
}

View File

@@ -788,7 +788,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
p!(write("{{"));
let coroutine_kind = self.tcx().coroutine_kind(did).unwrap();
let should_print_movability =
self.should_print_verbose() || coroutine_kind == hir::CoroutineKind::Gen;
self.should_print_verbose() || coroutine_kind == hir::CoroutineKind::Coroutine;
if should_print_movability {
match movability {

View File

@@ -748,7 +748,7 @@ impl<'tcx> TyCtxt<'tcx> {
DefKind::AssocFn if self.associated_item(def_id).fn_has_self_parameter => "method",
DefKind::Coroutine => match self.coroutine_kind(def_id).unwrap() {
rustc_hir::CoroutineKind::Async(..) => "async closure",
rustc_hir::CoroutineKind::Gen => "coroutine",
rustc_hir::CoroutineKind::Coroutine => "coroutine",
},
_ => def_kind.descr(def_id),
}
@@ -765,7 +765,7 @@ impl<'tcx> TyCtxt<'tcx> {
DefKind::AssocFn if self.associated_item(def_id).fn_has_self_parameter => "a",
DefKind::Coroutine => match self.coroutine_kind(def_id).unwrap() {
rustc_hir::CoroutineKind::Async(..) => "an",
rustc_hir::CoroutineKind::Gen => "a",
rustc_hir::CoroutineKind::Coroutine => "a",
},
_ => def_kind.article(),
}