diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2019-08-31 15:44:09 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2019-08-31 15:44:09 +0100 |
| commit | 877faf38440ada48b0c27100fa3c456b35bc5612 (patch) | |
| tree | ab75959b7524e88df196697a291b61238b2ab739 /src/librustc | |
| parent | 7bb2d8b0765e6737f43b501135d91bc8ab64db7a (diff) | |
| download | rust-877faf38440ada48b0c27100fa3c456b35bc5612.tar.gz rust-877faf38440ada48b0c27100fa3c456b35bc5612.zip | |
Check impl trait substs when checking for recursive types
This prevents mutual `async fn` recursion
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/ty/util.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 7a77418050c..a08c82a0ae8 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -709,8 +709,10 @@ impl<'tcx> TyCtxt<'tcx> { substs: SubstsRef<'tcx>, ) -> Option<Ty<'tcx>> { if self.found_recursion { - None - } else if self.seen_opaque_tys.insert(def_id) { + return None; + } + let substs = substs.fold_with(self); + if self.seen_opaque_tys.insert(def_id) { let generic_ty = self.tcx.type_of(def_id); let concrete_ty = generic_ty.subst(self.tcx, substs); let expanded_ty = self.fold_ty(concrete_ty); |
