Skip to content

Commit e3887e6

Browse files
committed
Rollup merge of #53551 - nnethercote:access_place_error_reported, r=varkor
Avoid some Place clones. This is a 0.5% speedup on ripgrep.
2 parents 0dd88c9 + c0636ab commit e3887e6

File tree

1 file changed

+4
-1
lines changed
  • src/librustc_mir/borrow_check

1 file changed

+4
-1
lines changed

Diff for: src/librustc_mir/borrow_check/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
10801080
}
10811081
}
10821082

1083-
if self
1083+
// Check is_empty() first because it's the common case, and doing that
1084+
// way we avoid the clone() call.
1085+
if !self.access_place_error_reported.is_empty() &&
1086+
self
10841087
.access_place_error_reported
10851088
.contains(&(place_span.0.clone(), place_span.1))
10861089
{

0 commit comments

Comments
 (0)