@@ -23,6 +23,7 @@ use rustc_middle::hir::place::ProjectionKind;
2323// Export these here so that Clippy can use them.
2424pub use rustc_middle:: hir:: place:: { Place , PlaceBase , PlaceWithHirId , Projection } ;
2525use rustc_middle:: mir:: FakeReadCause ;
26+ use rustc_middle:: thir:: DerefPatBorrowMode ;
2627use rustc_middle:: ty:: {
2728 self , BorrowKind , Ty , TyCtxt , TypeFoldable , TypeVisitableExt as _, adjustment,
2829} ;
@@ -1004,7 +1005,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
10041005 // Deref patterns on boxes don't borrow, so we ignore them here.
10051006 // HACK: this could be a fake pattern corresponding to a deref inserted by match
10061007 // ergonomics, in which case `pat.hir_id` will be the id of the subpattern.
1007- if let hir :: ByRef :: Yes ( _ , mutability) =
1008+ if let DerefPatBorrowMode :: Borrow ( mutability) =
10081009 self . cx . typeck_results ( ) . deref_pat_borrow_mode ( place. place . ty ( ) , subpattern)
10091010 {
10101011 let bk = ty:: BorrowKind :: from_mutbl ( mutability) ;
@@ -1891,9 +1892,9 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
18911892 ) -> Result < PlaceWithHirId < ' tcx > , Cx :: Error > {
18921893 match self . cx . typeck_results ( ) . deref_pat_borrow_mode ( base_place. place . ty ( ) , inner) {
18931894 // Deref patterns on boxes are lowered using a built-in deref.
1894- hir :: ByRef :: No => self . cat_deref ( hir_id, base_place) ,
1895+ DerefPatBorrowMode :: Box => self . cat_deref ( hir_id, base_place) ,
18951896 // For other types, we create a temporary to match on.
1896- hir :: ByRef :: Yes ( _ , mutability) => {
1897+ DerefPatBorrowMode :: Borrow ( mutability) => {
18971898 let re_erased = self . cx . tcx ( ) . lifetimes . re_erased ;
18981899 let ty = Ty :: new_ref ( self . cx . tcx ( ) , re_erased, target_ty, mutability) ;
18991900 // A deref pattern stores the result of `Deref::deref` or `DerefMut::deref_mut` ...
0 commit comments