From 474d0e33717062696be4c9799ce9822bf7b56fc2 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 28 Jan 2020 00:52:21 +0100 Subject: [PATCH] Add an early-exit to `QueryNormalizer::fold_ty` --- src/librustc/traits/query/normalize.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 8f23f98a2a4..20d7b556377 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -81,6 +81,10 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> { } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { + if !ty.has_projections() { + return ty; + } + let ty = ty.super_fold_with(self); match ty.kind { ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {