@@ -5,7 +5,6 @@ use crate::rmeta::encoder;
5
5
6
6
use rustc_ast as ast;
7
7
use rustc_data_structures:: stable_map:: FxHashMap ;
8
- use rustc_data_structures:: svh:: Svh ;
9
8
use rustc_hir as hir;
10
9
use rustc_hir:: def:: { CtorKind , DefKind } ;
11
10
use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , CRATE_DEF_INDEX , LOCAL_CRATE } ;
@@ -369,6 +368,7 @@ pub fn provide(providers: &mut Providers) {
369
368
tcx. arena
370
369
. alloc_slice ( & CStore :: from_tcx ( tcx) . crate_dependencies_in_postorder ( LOCAL_CRATE ) )
371
370
} ,
371
+ crates : |tcx, ( ) | tcx. arena . alloc_slice ( & CStore :: from_tcx ( tcx) . crates_untracked ( ) ) ,
372
372
373
373
..* providers
374
374
} ;
@@ -451,6 +451,16 @@ impl CStore {
451
451
self . get_crate_data ( def_id. krate ) . get_span ( def_id. index , sess)
452
452
}
453
453
454
+ pub fn def_kind ( & self , def : DefId ) -> DefKind {
455
+ self . get_crate_data ( def. krate ) . def_kind ( def. index )
456
+ }
457
+
458
+ pub fn crates_untracked ( & self ) -> Vec < CrateNum > {
459
+ let mut result = vec ! [ ] ;
460
+ self . iter_crate_data ( |cnum, _| result. push ( cnum) ) ;
461
+ result
462
+ }
463
+
454
464
pub fn item_generics_num_lifetimes ( & self , def_id : DefId , sess : & Session ) -> usize {
455
465
self . get_crate_data ( def_id. krate ) . get_generics ( def_id. index , sess) . own_counts ( ) . lifetimes
456
466
}
@@ -485,29 +495,21 @@ impl CrateStore for CStore {
485
495
self
486
496
}
487
497
488
- fn crate_name_untracked ( & self , cnum : CrateNum ) -> Symbol {
498
+ fn crate_name ( & self , cnum : CrateNum ) -> Symbol {
489
499
self . get_crate_data ( cnum) . root . name
490
500
}
491
501
492
- fn stable_crate_id_untracked ( & self , cnum : CrateNum ) -> StableCrateId {
502
+ fn stable_crate_id ( & self , cnum : CrateNum ) -> StableCrateId {
493
503
self . get_crate_data ( cnum) . root . stable_crate_id
494
504
}
495
505
496
- fn crate_hash_untracked ( & self , cnum : CrateNum ) -> Svh {
497
- self . get_crate_data ( cnum) . root . hash
498
- }
499
-
500
506
/// Returns the `DefKey` for a given `DefId`. This indicates the
501
507
/// parent `DefId` as well as some idea of what kind of data the
502
508
/// `DefId` refers to.
503
509
fn def_key ( & self , def : DefId ) -> DefKey {
504
510
self . get_crate_data ( def. krate ) . def_key ( def. index )
505
511
}
506
512
507
- fn def_kind ( & self , def : DefId ) -> DefKind {
508
- self . get_crate_data ( def. krate ) . def_kind ( def. index )
509
- }
510
-
511
513
fn def_path ( & self , def : DefId ) -> DefPath {
512
514
self . get_crate_data ( def. krate ) . def_path ( def. index )
513
515
}
@@ -526,12 +528,6 @@ impl CrateStore for CStore {
526
528
self . get_crate_data ( cnum) . def_path_hash_to_def_id ( cnum, index_guess, hash)
527
529
}
528
530
529
- fn crates_untracked ( & self ) -> Vec < CrateNum > {
530
- let mut result = vec ! [ ] ;
531
- self . iter_crate_data ( |cnum, _| result. push ( cnum) ) ;
532
- result
533
- }
534
-
535
531
fn encode_metadata ( & self , tcx : TyCtxt < ' _ > ) -> EncodedMetadata {
536
532
encoder:: encode_metadata ( tcx)
537
533
}
0 commit comments