fn walk_pat(&mut self, discr_place: &PlaceWithHirId<'tcx>, pat: &hir::Pat<'_>) {
        debug!("walk_pat(discr_place={:?}, pat={:?})", discr_place, pat);

        let tcx = self.tcx();
        let ExprUseVisitor { ref mc, ref mut delegate } = *self;
        return_if_err!(mc.cat_pattern(discr_place.clone(), pat, |place, pat| {
            if let PatKind::Binding(_, canonical_id, ..) = pat.kind {
                debug!("walk_pat: binding place={:?} pat={:?}", place, pat,);
                if let Some(bm) = mc.tables.extract_binding_mode(tcx.sess, pat.hir_id, pat.span) {
                    debug!("walk_pat: pat.hir_id={:?} bm={:?}", pat.hir_id, bm);

                    // pat_ty: the type of the binding being produced.
                    let pat_ty = return_if_err!(mc.node_ty(pat.hir_id));
                    debug!("walk_pat: pat_ty={:?}", pat_ty);

                    // Each match binding is effectively an assignment to the
                    // binding being produced.
                    let def = Res::Local(canonical_id);
                    if let Ok(ref binding_place) = mc.cat_res(pat.hir_id, pat.span, pat_ty, def) {
                        delegate.mutate(binding_place);
                    }

                    // It is also a borrow or copy/move of the value being matched.
                    match bm {
                        ty::BindByReference(m) => {
                            let bk = ty::BorrowKind::from_mutbl(m);
                            delegate.borrow(place, bk);
                        }
                        ty::BindByValue(..) => {
                            let mode = copy_or_move(mc, place);
                            debug!("walk_pat binding consuming pat");
                            delegate.consume(place, mode);
                        }
                    }
                }
            }
        }));
    }
/// The core driver for walking a pattern
The core driver for walking a pattern
The core driver for walking a pattern
fn walk_pat(&mut self, discr_place: &PlaceWithHirId<'tcx>, pat: &hir::Pat<'_>) {
        debug!("walk_pat(discr_place={:?}, pat={:?})", discr_place, pat);
        let tcx = self.tcx();
        let ExprUseVisitor { ref mc, ref mut delegate } = *self;
        return_if_err!(mc.cat_pattern(discr_place.clone(), pat, |place, pat| {
            if let PatKind::Binding(_, canonical_id, ..) = pat.kind {
                debug!("walk_pat: binding place={:?} pat={:?}", place, pat,);
                if let Some(bm) = mc.tables.extract_binding_mode(tcx.sess, pat.hir_id, pat.span) {
                    debug!("walk_pat: pat.hir_id={:?} bm={:?}", pat.hir_id, bm);
                    // pat_ty: the type of the binding being produced.
                    let pat_ty = return_if_err!(mc.node_ty(pat.hir_id));
                    debug!("walk_pat: pat_ty={:?}", pat_ty);
                    // Each match binding is effectively an assignment to the
                    // binding being produced.
                    let def = Res::Local(canonical_id);
                    if let Ok(ref binding_place) = mc.cat_res(pat.hir_id, pat.span, pat_ty, def) {
                        delegate.mutate(binding_place);
                    }
                    // It is also a borrow or copy/move of the value being matched.
                    match bm {
                        ty::BindByReference(m) => {
                            let bk = ty::BorrowKind::from_mutbl(m);
                            delegate.borrow(place, bk);
                        }
                        ty::BindByValue(..) => {
                            let mode = copy_or_move(mc, place);
                            debug!("walk_pat binding consuming pat");
                            delegate.consume(place, mode);
                        }
                    }
                }
            }
        }));
    }
fn walk_pat ( & mut self , discr_place : & PlaceWithHirId < ' tcx > , pat : & hir :: Pat < ' _ > ) { debug ! ( " " discr_place pat ) ; let tcx = self . tcx ( ) ; let ExprUseVisitor { ref mc , ref mut delegate } = * self ; return_if_err ! ( mc cat_pattern ( discr_place clone ( ) pat place pat { if let PatKind Binding ( canonical_id ) pat kind { debug ( " " place pat ) if let Some ( bm ) mc tables extract_binding_mode ( tcx sess pat hir_id pat span ) { debug ( " " pat hir_id bm ) // pat_ty: the type of the binding being produced. let pat_ty return_if_err ( mc node_ty ( pat hir_id ) ) debug ( " " pat_ty ) // Each match binding is effectively an assignment to the // binding being produced. let def Res Local ( canonical_id ) if let Ok ( ref binding_place ) mc cat_res ( pat hir_id pat span pat_ty def ) { delegate mutate ( binding_place ) } // It is also a borrow or copy/move of the value being matched. match bm { ty BindByReference ( m ) { let bk ty BorrowKind from_mutbl ( m ) delegate borrow ( place bk ) } ty BindByValue ( ) { let mode copy_or_move ( mc place ) debug ( " " ) delegate consume ( place mode ) } } } } } ) ) ; }
The core driver for walking a pattern
The core driver for walking a pattern
&mut self
discr_place
&PlaceWithHirId<'tcx>
pat
&hir::Pat<'_>
&mut self
discr_place
&PlaceWithHirId<'tcx>
pat
&hir::Pat<'_>