Auto merge of #117703 - compiler-errors:recursive-async, r= · rust-lang/rust@ab5373f (original) (raw)
`@@ -747,9 +747,13 @@ impl<'tcx> TyCtxt<'tcx> {
`
747
747
`match def_kind {
`
748
748
`DefKind::AssocFn if self.associated_item(def_id).fn_has_self_parameter => "method",
`
749
749
`DefKind::Coroutine => match self.coroutine_kind(def_id).unwrap() {
`
750
``
`-
rustc_hir::CoroutineKind::Async(..) => "async closure",
`
751
``
`-
rustc_hir::CoroutineKind::Coroutine => "coroutine",
`
752
``
`-
rustc_hir::CoroutineKind::Gen(..) => "gen closure",
`
``
750
`+
hir::CoroutineKind::Async(hir::CoroutineSource::Fn) => "async fn",
`
``
751
`+
hir::CoroutineKind::Async(hir::CoroutineSource::Block) => "async block",
`
``
752
`+
hir::CoroutineKind::Async(hir::CoroutineSource::Closure) => "async closure",
`
``
753
`+
hir::CoroutineKind::Gen(hir::CoroutineSource::Fn) => "gen fn",
`
``
754
`+
hir::CoroutineKind::Gen(hir::CoroutineSource::Block) => "gen block",
`
``
755
`+
hir::CoroutineKind::Gen(hir::CoroutineSource::Closure) => "gen closure",
`
``
756
`+
hir::CoroutineKind::Coroutine => "coroutine",
`
753
757
`},
`
754
758
` _ => def_kind.descr(def_id),
`
755
759
`}
`
`@@ -765,9 +769,9 @@ impl<'tcx> TyCtxt<'tcx> {
`
765
769
`match def_kind {
`
766
770
`DefKind::AssocFn if self.associated_item(def_id).fn_has_self_parameter => "a",
`
767
771
`DefKind::Coroutine => match self.coroutine_kind(def_id).unwrap() {
`
768
``
`-
rustc_hir::CoroutineKind::Async(..) => "an",
`
769
``
`-
rustc_hir::CoroutineKind::Coroutine => "a",
`
770
``
`-
rustc_hir::CoroutineKind::Gen(..) => "a",
`
``
772
`+
hir::CoroutineKind::Async(..) => "an",
`
``
773
`+
hir::CoroutineKind::Coroutine => "a",
`
``
774
`+
hir::CoroutineKind::Gen(..) => "a",
`
771
775
`},
`
772
776
` _ => def_kind.article(),
`
773
777
`}
`
`@@ -850,18 +854,7 @@ impl<'tcx> OpaqueTypeExpander<'tcx> {
`
850
854
`}
`
851
855
`let args = args.fold_with(self);
`
852
856
`if !self.check_recursion || self.seen_opaque_tys.insert(def_id) {
`
853
``
`-
let expanded_ty = match self.expanded_cache.get(&(def_id, args)) {
`
854
``
`-
Some(expanded_ty) => *expanded_ty,
`
855
``
`-
None => {
`
856
``
`-
for bty in self.tcx.coroutine_hidden_types(def_id) {
`
857
``
`-
let hidden_ty = bty.instantiate(self.tcx, args);
`
858
``
`-
self.fold_ty(hidden_ty);
`
859
``
`-
}
`
860
``
`-
let expanded_ty = Ty::new_coroutine_witness(self.tcx, def_id, args);
`
861
``
`-
self.expanded_cache.insert((def_id, args), expanded_ty);
`
862
``
`-
expanded_ty
`
863
``
`-
}
`
864
``
`-
};
`
``
857
`+
let expanded_ty = Ty::new_coroutine_witness(self.tcx, def_id, args);
`
865
858
`if self.check_recursion {
`
866
859
`self.seen_opaque_tys.remove(&def_id);
`
867
860
`}
`