@@ -5,7 +5,6 @@ use crate::rmeta::encoder;
55
66use rustc_ast as ast;
77use rustc_data_structures:: stable_map:: FxHashMap ;
8- use rustc_data_structures:: svh:: Svh ;
98use rustc_hir as hir;
109use rustc_hir:: def:: { CtorKind , DefKind } ;
1110use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , CRATE_DEF_INDEX , LOCAL_CRATE } ;
@@ -369,6 +368,7 @@ pub fn provide(providers: &mut Providers) {
369368 tcx. arena
370369 . alloc_slice ( & CStore :: from_tcx ( tcx) . crate_dependencies_in_postorder ( LOCAL_CRATE ) )
371370 } ,
371+ crates : |tcx, ( ) | tcx. arena . alloc_slice ( & CStore :: from_tcx ( tcx) . crates_untracked ( ) ) ,
372372
373373 ..* providers
374374 } ;
@@ -451,6 +451,16 @@ impl CStore {
451451 self . get_crate_data ( def_id. krate ) . get_span ( def_id. index , sess)
452452 }
453453
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+
454464 pub fn item_generics_num_lifetimes ( & self , def_id : DefId , sess : & Session ) -> usize {
455465 self . get_crate_data ( def_id. krate ) . get_generics ( def_id. index , sess) . own_counts ( ) . lifetimes
456466 }
@@ -485,29 +495,21 @@ impl CrateStore for CStore {
485495 self
486496 }
487497
488- fn crate_name_untracked ( & self , cnum : CrateNum ) -> Symbol {
498+ fn crate_name ( & self , cnum : CrateNum ) -> Symbol {
489499 self . get_crate_data ( cnum) . root . name
490500 }
491501
492- fn stable_crate_id_untracked ( & self , cnum : CrateNum ) -> StableCrateId {
502+ fn stable_crate_id ( & self , cnum : CrateNum ) -> StableCrateId {
493503 self . get_crate_data ( cnum) . root . stable_crate_id
494504 }
495505
496- fn crate_hash_untracked ( & self , cnum : CrateNum ) -> Svh {
497- self . get_crate_data ( cnum) . root . hash
498- }
499-
500506 /// Returns the `DefKey` for a given `DefId`. This indicates the
501507 /// parent `DefId` as well as some idea of what kind of data the
502508 /// `DefId` refers to.
503509 fn def_key ( & self , def : DefId ) -> DefKey {
504510 self . get_crate_data ( def. krate ) . def_key ( def. index )
505511 }
506512
507- fn def_kind ( & self , def : DefId ) -> DefKind {
508- self . get_crate_data ( def. krate ) . def_kind ( def. index )
509- }
510-
511513 fn def_path ( & self , def : DefId ) -> DefPath {
512514 self . get_crate_data ( def. krate ) . def_path ( def. index )
513515 }
@@ -526,12 +528,6 @@ impl CrateStore for CStore {
526528 self . get_crate_data ( cnum) . def_path_hash_to_def_id ( cnum, index_guess, hash)
527529 }
528530
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-
535531 fn encode_metadata ( & self , tcx : TyCtxt < ' _ > ) -> EncodedMetadata {
536532 encoder:: encode_metadata ( tcx)
537533 }
0 commit comments