@@ -14,7 +14,7 @@ use cstore::{self, CStore, CrateSource, MetadataBlob};
14
14
use locator:: { self , CratePaths } ;
15
15
use schema:: { CrateRoot , Tracked } ;
16
16
17
- use rustc:: hir:: def_id:: { CrateNum , DefIndex , CRATE_DEF_INDEX } ;
17
+ use rustc:: hir:: def_id:: { CrateNum , DefIndex } ;
18
18
use rustc:: hir:: svh:: Svh ;
19
19
use rustc:: middle:: cstore:: DepKind ;
20
20
use rustc:: session:: Session ;
@@ -26,8 +26,7 @@ use rustc::middle::cstore::{CrateStore, validate_crate_name, ExternCrate};
26
26
use rustc:: util:: common:: record_time;
27
27
use rustc:: util:: nodemap:: FxHashSet ;
28
28
use rustc:: middle:: cstore:: NativeLibrary ;
29
- use rustc:: hir:: map:: { Definitions , DefKey , DefPathData , DisambiguatedDefPathData , ITEM_LIKE_SPACE } ;
30
- use rustc:: hir:: map:: definitions:: DefPathTable ;
29
+ use rustc:: hir:: map:: Definitions ;
31
30
32
31
use std:: cell:: { RefCell , Cell } ;
33
32
use std:: ops:: Deref ;
@@ -308,16 +307,9 @@ impl<'a> CrateLoader<'a> {
308
307
309
308
let cnum_map = self . resolve_crate_deps ( root, & crate_root, & metadata, cnum, span, dep_kind) ;
310
309
311
- let proc_macros = crate_root . macro_derive_registrar . map ( |_ | {
312
- self . load_derive_macros ( & crate_root, dylib . clone ( ) . map ( |p| p . 0 ) , span )
310
+ let def_path_table = record_time ( & self . sess . perf_stats . decode_def_path_tables_time , | | {
311
+ crate_root. def_path_table . decode ( & metadata )
313
312
} ) ;
314
- let def_path_table = if let Some ( ref proc_macros) = proc_macros {
315
- proc_macro_def_path_table ( proc_macros)
316
- } else {
317
- record_time ( & self . sess . perf_stats . decode_def_path_tables_time , || {
318
- crate_root. def_path_table . decode ( & metadata)
319
- } )
320
- } ;
321
313
322
314
let exported_symbols = crate_root. exported_symbols
323
315
. map ( |x| x. decode ( & metadata) . collect ( ) ) ;
@@ -336,7 +328,9 @@ impl<'a> CrateLoader<'a> {
336
328
def_path_table : Rc :: new ( def_path_table) ,
337
329
exported_symbols : exported_symbols,
338
330
trait_impls : trait_impls,
339
- proc_macros : proc_macros,
331
+ proc_macros : crate_root. macro_derive_registrar . map ( |_| {
332
+ self . load_derive_macros ( & crate_root, dylib. clone ( ) . map ( |p| p. 0 ) , span)
333
+ } ) ,
340
334
root : crate_root,
341
335
blob : metadata,
342
336
cnum_map : RefCell :: new ( cnum_map) ,
@@ -1219,31 +1213,3 @@ impl<'a> middle::cstore::CrateLoader for CrateLoader<'a> {
1219
1213
}
1220
1214
}
1221
1215
}
1222
-
1223
- fn proc_macro_def_path_table ( proc_macros : & [ ( ast:: Name , Rc < SyntaxExtension > ) ] ) -> DefPathTable {
1224
- let mut table = DefPathTable :: new ( ) ;
1225
- let root = DefKey {
1226
- parent : None ,
1227
- disambiguated_data : DisambiguatedDefPathData {
1228
- data : DefPathData :: CrateRoot ,
1229
- disambiguator : 0 ,
1230
- } ,
1231
- } ;
1232
-
1233
- let initial_hash = DefKey :: root_parent_stable_hash ( "" , "" ) ;
1234
- let root_hash = root. compute_stable_hash ( initial_hash) ;
1235
- let root_id = table. allocate ( root, root_hash, ITEM_LIKE_SPACE ) ;
1236
- let root_path_hash = table. def_path_hash ( root_id) ;
1237
- for proc_macro in proc_macros {
1238
- let key = DefKey {
1239
- parent : Some ( CRATE_DEF_INDEX ) ,
1240
- disambiguated_data : DisambiguatedDefPathData {
1241
- data : DefPathData :: MacroDef ( proc_macro. 0 ) ,
1242
- disambiguator : 0 ,
1243
- } ,
1244
- } ;
1245
- let def_path_hash = key. compute_stable_hash ( root_path_hash) ;
1246
- table. allocate ( key, def_path_hash, ITEM_LIKE_SPACE ) ;
1247
- }
1248
- table
1249
- }
0 commit comments