Rename CoroutineKind::Gen to ::Coroutine
This commit is contained in:
@@ -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!(
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user