From 6493e6b86e10805814a85e278b363232696da2bb Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Thu, 10 Oct 2019 16:38:53 -0700 Subject: [PATCH] Only expand types that contain projections --- src/librustc/ty/util.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 131a4ed312731..acf6f2845d2af 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -745,8 +745,10 @@ impl<'tcx> TyCtxt<'tcx> { fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> { if let ty::Opaque(def_id, substs) = t.kind { self.expand_opaque_ty(def_id, substs).unwrap_or(t) - } else { + } else if t.has_projections() { t.super_fold_with(self) + } else { + t } } }