Rename AsyncCoroutineKind to CoroutineSource
similar to how we have `MatchSource`, it explains where the desugaring came from.
This commit is contained in:
@@ -22,7 +22,7 @@ use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_hir::is_range_literal;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::{AsyncCoroutineKind, CoroutineKind, Node};
|
||||
use rustc_hir::{CoroutineKind, CoroutineSource, Node};
|
||||
use rustc_hir::{Expr, HirId};
|
||||
use rustc_infer::infer::error_reporting::TypeErrCtxt;
|
||||
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
@@ -2410,7 +2410,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
.and_then(|coroutine_did| {
|
||||
Some(match self.tcx.coroutine_kind(coroutine_did).unwrap() {
|
||||
CoroutineKind::Coroutine => format!("coroutine is not {trait_name}"),
|
||||
CoroutineKind::Async(AsyncCoroutineKind::Fn) => self
|
||||
CoroutineKind::Async(CoroutineSource::Fn) => self
|
||||
.tcx
|
||||
.parent(coroutine_did)
|
||||
.as_local()
|
||||
@@ -2419,10 +2419,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
.map(|name| {
|
||||
format!("future returned by `{name}` is not {trait_name}")
|
||||
})?,
|
||||
CoroutineKind::Async(AsyncCoroutineKind::Block) => {
|
||||
CoroutineKind::Async(CoroutineSource::Block) => {
|
||||
format!("future created by async block is not {trait_name}")
|
||||
}
|
||||
CoroutineKind::Async(AsyncCoroutineKind::Closure) => {
|
||||
CoroutineKind::Async(CoroutineSource::Closure) => {
|
||||
format!("future created by async closure is not {trait_name}")
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1611,9 +1611,9 @@ 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::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",
|
||||
hir::CoroutineKind::Async(hir::CoroutineSource::Block) => "an async block",
|
||||
hir::CoroutineKind::Async(hir::CoroutineSource::Fn) => "an async function",
|
||||
hir::CoroutineKind::Async(hir::CoroutineSource::Closure) => "an async closure",
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user