@@ -9,7 +9,6 @@ use rustc_hir::intravisit::{self, Visitor};
9
9
use rustc_hir:: { self as hir} ;
10
10
use rustc_interface:: interface;
11
11
use rustc_macros:: { Decodable , Encodable } ;
12
- use rustc_middle:: hir:: map:: Map ;
13
12
use rustc_middle:: hir:: nested_filter;
14
13
use rustc_middle:: ty:: { self , TyCtxt } ;
15
14
use rustc_serialize:: opaque:: { FileEncoder , MemDecoder } ;
@@ -107,8 +106,6 @@ pub(crate) type AllCallLocations = FxIndexMap<DefPathHash, FnCallLocations>;
107
106
108
107
/// Visitor for traversing a crate and finding instances of function calls.
109
108
struct FindCalls < ' a , ' tcx > {
110
- tcx : TyCtxt < ' tcx > ,
111
- map : Map < ' tcx > ,
112
109
cx : Context < ' tcx > ,
113
110
target_crates : Vec < CrateNum > ,
114
111
calls : & ' a mut AllCallLocations ,
@@ -122,13 +119,13 @@ where
122
119
type NestedFilter = nested_filter:: OnlyBodies ;
123
120
124
121
fn nested_visit_map ( & mut self ) -> Self :: Map {
125
- self . map
122
+ self . cx . tcx ( ) . hir ( )
126
123
}
127
124
128
125
fn visit_expr ( & mut self , ex : & ' tcx hir:: Expr < ' tcx > ) {
129
126
intravisit:: walk_expr ( self , ex) ;
130
127
131
- let tcx = self . tcx ;
128
+ let tcx = self . cx . tcx ( ) ;
132
129
133
130
// If we visit an item that contains an expression outside a function body,
134
131
// then we need to exit before calling typeck (which will panic). See
@@ -294,8 +291,7 @@ pub(crate) fn run(
294
291
295
292
// Run call-finder on all items
296
293
let mut calls = FxIndexMap :: default ( ) ;
297
- let mut finder =
298
- FindCalls { calls : & mut calls, tcx, map : tcx. hir ( ) , cx, target_crates, bin_crate } ;
294
+ let mut finder = FindCalls { calls : & mut calls, cx, target_crates, bin_crate } ;
299
295
tcx. hir ( ) . visit_all_item_likes_in_crate ( & mut finder) ;
300
296
301
297
// The visitor might have found a type error, which we need to
0 commit comments