about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-07 07:06:14 +0000
committerbors <bors@rust-lang.org>2018-07-07 07:06:14 +0000
commit599d2c01e023bda2a0d861d1faaab178f33d19b2 (patch)
treee3540025e37616b498023ef23a80676725a1908b /src
parent4f0ca9248f93162201ea88a99594deedf0ebd897 (diff)
parent0190286d488365e033fa9210188b15fc46e22764 (diff)
downloadrust-599d2c01e023bda2a0d861d1faaab178f33d19b2.tar.gz
rust-599d2c01e023bda2a0d861d1faaab178f33d19b2.zip
Auto merge of #52037 - lqd:skipping-regionless-types, r=nikomatsakis
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

Closes #52027
Diffstat (limited to 'src')
-rw-r--r--src/librustc/ty/fold.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs
index 076a19fb4ed..1380d10e493 100644
--- a/src/librustc/ty/fold.rs
+++ b/src/librustc/ty/fold.rs
@@ -325,6 +325,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
                     _ => (self.callback)(r),
                 }
             }
+
+            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
+                }
+            }
         }
     }
 }