diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-08-21 18:06:55 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-08-21 18:06:55 +1000 |
| commit | c0636ab087927152ed9dfdb0f532429f1626f57f (patch) | |
| tree | 2bfd78e9c5836bd4ace5e617c59a69ce06b705d5 /src | |
| parent | 3ac79c718475fd29b8be34dde667b683390c2aee (diff) | |
| download | rust-c0636ab087927152ed9dfdb0f532429f1626f57f.tar.gz rust-c0636ab087927152ed9dfdb0f532429f1626f57f.zip | |
Avoid some Place clones.
This is a 0.5% speedup on ripgrep.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/borrow_check/mod.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index ce0e76a636d..9d5be714ac7 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1080,7 +1080,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } } - if self + // Check is_empty() first because it's the common case, and doing that + // way we avoid the clone() call. + if !self.access_place_error_reported.is_empty() && + self .access_place_error_reported .contains(&(place_span.0.clone(), place_span.1)) { |
