1
Fork 0

Only regular coroutines have movability

This commit is contained in:
Michael Goulet 2023-12-25 16:56:12 +00:00
parent 909dd864f1
commit 3320c09eab
25 changed files with 130 additions and 104 deletions

View file

@ -2577,7 +2577,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::Coroutine => format!("coroutine is not {trait_name}"),
CoroutineKind::Coroutine(_) => format!("coroutine is not {trait_name}"),
CoroutineKind::Desugared(
CoroutineDesugaring::Async,
CoroutineSource::Fn,
@ -3169,7 +3169,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::Coroutine)
| Some(hir::CoroutineKind::Coroutine(_))
| Some(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen, _)) => {
"yield"
}

View file

@ -1928,8 +1928,8 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
fn describe_closure(&self, kind: hir::ClosureKind) -> &'static str {
match kind {
hir::ClosureKind::Closure => "a closure",
hir::ClosureKind::Coroutine(kind, _) => match kind {
hir::CoroutineKind::Coroutine => "a coroutine",
hir::ClosureKind::Coroutine(kind) => match kind {
hir::CoroutineKind::Coroutine(_) => "a coroutine",
hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::Async,
hir::CoroutineSource::Block,