Remove region from UpvarCapture and move it to CapturedPlace
Region info is completely unnecessary for upvar capture kind computation and is only needed to create the final upvar tuple ty. Doing so makes creation of UpvarCapture very cheap and expose further cleanup opportunity.
This commit is contained in:
parent
356b0246d9
commit
7e2ccb0154
@ -970,7 +970,7 @@ pub fn can_move_expr_to_closure(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) ->
|
||||
if !self.locals.contains(&local_id) {
|
||||
let capture = match capture.info.capture_kind {
|
||||
UpvarCapture::ByValue => CaptureKind::Value,
|
||||
UpvarCapture::ByRef(borrow) => match borrow.kind {
|
||||
UpvarCapture::ByRef(kind) => match kind {
|
||||
BorrowKind::ImmBorrow => CaptureKind::Ref(Mutability::Not),
|
||||
BorrowKind::UniqueImmBorrow | BorrowKind::MutBorrow => {
|
||||
CaptureKind::Ref(Mutability::Mut)
|
||||
|
Loading…
x
Reference in New Issue
Block a user