11
11
// Searching for information from the cstore
12
12
13
13
use front:: map as ast_map;
14
- use metadata:: common:: * ;
15
14
use metadata:: cstore;
16
15
use metadata:: decoder;
17
16
use metadata:: inline:: InlinedItem ;
18
17
use middle:: def_id:: DefId ;
19
18
use middle:: lang_items;
20
19
use middle:: ty;
20
+ use util:: nodemap:: FnvHashMap ;
21
21
22
- use rbml;
23
- use rbml:: reader;
24
22
use std:: rc:: Rc ;
25
23
use syntax:: ast;
26
24
use rustc_front:: attr;
27
25
use rustc_front:: hir;
28
- use syntax:: diagnostic:: expect;
29
-
30
- use std:: collections:: hash_map:: HashMap ;
31
26
32
27
#[ derive( Copy , Clone ) ]
33
28
pub struct MethodInfo {
@@ -38,7 +33,7 @@ pub struct MethodInfo {
38
33
39
34
pub fn get_symbol ( cstore : & cstore:: CStore , def : DefId ) -> String {
40
35
let cdata = cstore. get_crate_data ( def. krate ) ;
41
- decoder:: get_symbol ( cdata. data ( ) , def. node )
36
+ decoder:: get_symbol ( & cdata, def. node )
42
37
}
43
38
44
39
/// Iterates over all the language items in the given crate.
@@ -201,7 +196,7 @@ pub fn get_struct_field_names(cstore: &cstore::CStore, def: DefId) -> Vec<ast::N
201
196
decoder:: get_struct_field_names ( & cstore. intr , & * cdata, def. node )
202
197
}
203
198
204
- pub fn get_struct_field_attrs ( cstore : & cstore:: CStore , def : DefId ) -> HashMap < ast:: NodeId ,
199
+ pub fn get_struct_field_attrs ( cstore : & cstore:: CStore , def : DefId ) -> FnvHashMap < ast:: NodeId ,
205
200
Vec < hir:: Attribute > > {
206
201
let cdata = cstore. get_crate_data ( def. krate ) ;
207
202
decoder:: get_struct_field_attrs ( & * cdata)
@@ -243,31 +238,6 @@ pub fn get_super_predicates<'tcx>(tcx: &ty::ctxt<'tcx>, def: DefId)
243
238
decoder:: get_super_predicates ( & * cdata, def. node , tcx)
244
239
}
245
240
246
- pub fn get_field_type < ' tcx > ( tcx : & ty:: ctxt < ' tcx > , class_id : DefId ,
247
- def : DefId ) -> ty:: TypeScheme < ' tcx > {
248
- let cstore = & tcx. sess . cstore ;
249
- let cdata = cstore. get_crate_data ( class_id. krate ) ;
250
- let all_items = reader:: get_doc ( rbml:: Doc :: new ( cdata. data ( ) ) , tag_items) ;
251
- let class_doc = expect ( tcx. sess . diagnostic ( ) ,
252
- decoder:: maybe_find_item ( class_id. node , all_items) ,
253
- || {
254
- ( format ! ( "get_field_type: class ID {:?} not found" ,
255
- class_id) ) . to_string ( )
256
- } ) ;
257
- let the_field = expect ( tcx. sess . diagnostic ( ) ,
258
- decoder:: maybe_find_item ( def. node , class_doc) ,
259
- || {
260
- ( format ! ( "get_field_type: in class {:?}, field ID {:?} not found" ,
261
- class_id,
262
- def) ) . to_string ( )
263
- } ) ;
264
- let ty = decoder:: item_type ( def, the_field, tcx, & * cdata) ;
265
- ty:: TypeScheme {
266
- generics : ty:: Generics :: empty ( ) ,
267
- ty : ty,
268
- }
269
- }
270
-
271
241
pub fn get_impl_polarity < ' tcx > ( tcx : & ty:: ctxt < ' tcx > ,
272
242
def : DefId )
273
243
-> Option < hir:: ImplPolarity >
0 commit comments