From 0190286d488365e033fa9210188b15fc46e22764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=CC=81my=20Rakic?= Date: Wed, 4 Jul 2018 00:31:12 +0200 Subject: [PATCH] NLL Liveness: Skip regionless types when visiting free regions The tuple-stress benchmark exercises the liveness constraint generation code for types which do not have regions --- src/librustc/ty/fold.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index f55a512908499..a933d7e6de8b7 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -307,6 +307,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { false // keep visiting } + + fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { + // We're only interested in types involving regions + if ty.flags.intersects(TypeFlags::HAS_FREE_REGIONS) { + ty.super_visit_with(self) + } else { + false // keep visiting + } + } } } }