diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-09-29 20:34:28 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-10-03 13:32:24 +1100 |
| commit | 1fece3d84b41bf1d544e48b10823f3dade45a120 (patch) | |
| tree | e63e05c7193f5d4c7c4f04f633b4bbb14ce976cd /src | |
| parent | 8ccfc695b56c102a2e7e95719b398bfa0a5e8af1 (diff) | |
| download | rust-1fece3d84b41bf1d544e48b10823f3dade45a120.tar.gz rust-1fece3d84b41bf1d544e48b10823f3dade45a120.zip | |
Optimize plug_leaks.
This commit avoids the `fold_regions` call in `plug_leaks` when `skol_map` is empty, which is the common case. This gives speed-ups of up to 1.14x on some of the rustc-benchmarks.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/infer/higher_ranked/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librustc/infer/higher_ranked/mod.rs b/src/librustc/infer/higher_ranked/mod.rs index 7c02de05d26..980c7d3e991 100644 --- a/src/librustc/infer/higher_ranked/mod.rs +++ b/src/librustc/infer/higher_ranked/mod.rs @@ -756,6 +756,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { skol_map, value); + if skol_map.is_empty() { + return self.resolve_type_vars_if_possible(value); + } + // Compute a mapping from the "taint set" of each skolemized // region back to the `ty::BoundRegion` that it originally // represented. Because `leak_check` passed, we know that @@ -813,9 +817,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } }); - debug!("plug_leaks: result={:?}", - result); - self.pop_skolemized(skol_map, snapshot); debug!("plug_leaks: result={:?}", result); |
