@@ -363,6 +363,9 @@ impl<'tcx> TyCtxt<'tcx> {
363363 pub fn feed_unit_query ( self ) -> TyCtxtFeed < ' tcx , ( ) > {
364364 TyCtxtFeed { tcx : self , key : ( ) }
365365 }
366+ pub fn feed_local_crate ( self ) -> TyCtxtFeed < ' tcx , CrateNum > {
367+ TyCtxtFeed { tcx : self , key : LOCAL_CRATE }
368+ }
366369}
367370
368371impl < ' tcx , KEY : Copy > TyCtxtFeed < ' tcx , KEY > {
@@ -456,10 +459,6 @@ pub struct GlobalCtxt<'tcx> {
456459 /// Merge this with `selection_cache`?
457460 pub evaluation_cache : traits:: EvaluationCache < ' tcx > ,
458461
459- /// The definite name of the current crate after taking into account
460- /// attributes, commandline parameters, etc.
461- crate_name : Symbol ,
462-
463462 /// Data layout specification for the current target.
464463 pub data_layout : TargetDataLayout ,
465464
@@ -597,7 +596,6 @@ impl<'tcx> TyCtxt<'tcx> {
597596 on_disk_cache : Option < & ' tcx dyn OnDiskCache < ' tcx > > ,
598597 queries : & ' tcx dyn query:: QueryEngine < ' tcx > ,
599598 query_kinds : & ' tcx [ DepKindStruct < ' tcx > ] ,
600- crate_name : Symbol ,
601599 output_filenames : OutputFilenames ,
602600 ) -> GlobalCtxt < ' tcx > {
603601 let data_layout = s. target . parse_data_layout ( ) . unwrap_or_else ( |err| {
@@ -629,7 +627,6 @@ impl<'tcx> TyCtxt<'tcx> {
629627 pred_rcache : Default :: default ( ) ,
630628 selection_cache : Default :: default ( ) ,
631629 evaluation_cache : Default :: default ( ) ,
632- crate_name,
633630 data_layout,
634631 alloc_map : Lock :: new ( interpret:: AllocMap :: new ( ) ) ,
635632 output_filenames : Arc :: new ( output_filenames) ,
@@ -807,7 +804,7 @@ impl<'tcx> TyCtxt<'tcx> {
807804 // statements within the query system and we'd run into endless
808805 // recursion otherwise.
809806 let ( crate_name, stable_crate_id) = if def_id. is_local ( ) {
810- ( self . crate_name , self . sess . local_stable_crate_id ( ) )
807+ ( self . crate_name ( LOCAL_CRATE ) , self . sess . local_stable_crate_id ( ) )
811808 } else {
812809 let cstore = & * self . untracked . cstore ;
813810 ( cstore. crate_name ( def_id. krate ) , cstore. stable_crate_id ( def_id. krate ) )
@@ -2406,10 +2403,6 @@ fn ptr_eq<T, U>(t: *const T, u: *const U) -> bool {
24062403pub fn provide ( providers : & mut ty:: query:: Providers ) {
24072404 providers. module_reexports =
24082405 |tcx, id| tcx. resolutions ( ( ) ) . reexport_map . get ( & id) . map ( |v| & v[ ..] ) ;
2409- providers. crate_name = |tcx, id| {
2410- assert_eq ! ( id, LOCAL_CRATE ) ;
2411- tcx. crate_name
2412- } ;
24132406 providers. maybe_unused_trait_imports =
24142407 |tcx, ( ) | & tcx. resolutions ( ( ) ) . maybe_unused_trait_imports ;
24152408 providers. maybe_unused_extern_crates =
0 commit comments