@@ -1662,7 +1662,7 @@ fn check_for_mutation(
16621662 } ;
16631663 let def_id = def_id:: DefId :: local ( body. hir_id . owner ) ;
16641664 let region_scope_tree = & cx. tcx . region_scope_tree ( def_id) ;
1665- ExprUseVisitor :: new ( & mut delegate, cx. tcx , cx. param_env , region_scope_tree, cx. tables , None ) . walk_expr ( body) ;
1665+ ExprUseVisitor :: new ( & mut delegate, cx. tcx , def_id , cx. param_env , region_scope_tree, cx. tables , None ) . walk_expr ( body) ;
16661666 delegate. mutation_span ( )
16671667}
16681668
@@ -1769,7 +1769,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
17691769 }
17701770 let res = self . cx. tables. qpath_res( seqpath, seqexpr. hir_id) ;
17711771 match res {
1772- Res :: Local ( hir_id) | Res :: Upvar ( hir_id , .. ) => {
1772+ Res :: Local ( hir_id) => {
17731773 let parent_id = self . cx. tcx. hir( ) . get_parent_item( expr. hir_id) ;
17741774 let parent_def_id = self . cx. tcx. hir( ) . local_def_id_from_hir_id( parent_id) ;
17751775 let extent = self . cx. tcx. region_scope_tree( parent_def_id) . var_scope( hir_id. local_id) ;
@@ -1829,24 +1829,13 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
18291829 if let QPath :: Resolved ( None , ref path) = * qpath;
18301830 if path. segments. len( ) == 1 ;
18311831 then {
1832- match self . cx. tables. qpath_res( qpath, expr. hir_id) {
1833- Res :: Upvar ( local_id, ..) => {
1834- if local_id == self . var {
1835- // we are not indexing anything, record that
1836- self . nonindex = true ;
1837- }
1838- }
1839- Res :: Local ( local_id) =>
1840- {
1841-
1842- if local_id == self . var {
1843- self . nonindex = true ;
1844- } else {
1845- // not the correct variable, but still a variable
1846- self . referenced. insert( path. segments[ 0 ] . ident. name) ;
1847- }
1832+ if let Res :: Local ( local_id) = self . cx. tables. qpath_res( qpath, expr. hir_id) {
1833+ if local_id == self . var {
1834+ self . nonindex = true ;
1835+ } else {
1836+ // not the correct variable, but still a variable
1837+ self . referenced. insert( path. segments[ 0 ] . ident. name) ;
18481838 }
1849- _ => { }
18501839 }
18511840 }
18521841 }
@@ -2378,7 +2367,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
23782367 let res = self . cx. tables. qpath_res( qpath, ex. hir_id) ;
23792368 then {
23802369 match res {
2381- Res :: Local ( node_id) | Res :: Upvar ( node_id , .. ) => {
2370+ Res :: Local ( node_id) => {
23822371 self . ids. insert( node_id) ;
23832372 } ,
23842373 Res :: Def ( DefKind :: Static , def_id) => {
0 commit comments