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:
commit
6cf088810f
10 changed files with 35 additions and 50 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue