about summary refs log tree commit diff
path: root/compiler/rustc_mir_build
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2021-10-13 21:20:10 +0100
committerGary Guo <gary@garyguo.net>2022-01-07 22:55:34 +0000
commit48258ffe5af8a8fc2926e9e0bb8dc857ad8bfed6 (patch)
tree0320699e541e9a70e0cb85d3478aa65b384d55f8 /compiler/rustc_mir_build
parent3698e03fb60893786843df01b50dc8326f6c5c5a (diff)
downloadrust-48258ffe5af8a8fc2926e9e0bb8dc857ad8bfed6.tar.gz
rust-48258ffe5af8a8fc2926e9e0bb8dc857ad8bfed6.zip
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.
Diffstat (limited to 'compiler/rustc_mir_build')
-rw-r--r--compiler/rustc_mir_build/src/thir/cx/expr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs
index 1c03c7b0605..c62de154388 100644
--- a/compiler/rustc_mir_build/src/thir/cx/expr.rs
+++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs
@@ -1110,7 +1110,7 @@ impl<'tcx> Cx<'tcx> {
         match upvar_capture {
             ty::UpvarCapture::ByValue => captured_place_expr,
             ty::UpvarCapture::ByRef(upvar_borrow) => {
-                let borrow_kind = match upvar_borrow.kind {
+                let borrow_kind = match upvar_borrow {
                     ty::BorrowKind::ImmBorrow => BorrowKind::Shared,
                     ty::BorrowKind::UniqueImmBorrow => BorrowKind::Unique,
                     ty::BorrowKind::MutBorrow => BorrowKind::Mut { allow_two_phase_borrow: false },