1
Fork 0

Auto merge of #118316 - Mark-Simulacrum:delete-copy-to-upvars, r=cjgillot

Remove borrowck Upvar duplication

This cuts out an extra allocation and copying over from the already cached closure capture information.
This commit is contained in:
bors 2023-11-26 21:47:19 +00:00
commit 6cf088810f
10 changed files with 35 additions and 50 deletions

View file

@ -247,6 +247,13 @@ impl<'tcx> CapturedPlace<'tcx> {
.span
}
}
pub fn is_by_ref(&self) -> bool {
match self.info.capture_kind {
ty::UpvarCapture::ByValue => false,
ty::UpvarCapture::ByRef(..) => true,
}
}
}
#[derive(Copy, Clone, Debug, HashStable)]