@@ -363,6 +363,9 @@ impl<'tcx> TyCtxt<'tcx> {
363
363
pub fn feed_unit_query ( self ) -> TyCtxtFeed < ' tcx , ( ) > {
364
364
TyCtxtFeed { tcx : self , key : ( ) }
365
365
}
366
+ pub fn feed_local_crate ( self ) -> TyCtxtFeed < ' tcx , CrateNum > {
367
+ TyCtxtFeed { tcx : self , key : LOCAL_CRATE }
368
+ }
366
369
}
367
370
368
371
impl < ' tcx , KEY : Copy > TyCtxtFeed < ' tcx , KEY > {
@@ -456,10 +459,6 @@ pub struct GlobalCtxt<'tcx> {
456
459
/// Merge this with `selection_cache`?
457
460
pub evaluation_cache : traits:: EvaluationCache < ' tcx > ,
458
461
459
- /// The definite name of the current crate after taking into account
460
- /// attributes, commandline parameters, etc.
461
- crate_name : Symbol ,
462
-
463
462
/// Data layout specification for the current target.
464
463
pub data_layout : TargetDataLayout ,
465
464
@@ -597,7 +596,6 @@ impl<'tcx> TyCtxt<'tcx> {
597
596
on_disk_cache : Option < & ' tcx dyn OnDiskCache < ' tcx > > ,
598
597
queries : & ' tcx dyn query:: QueryEngine < ' tcx > ,
599
598
query_kinds : & ' tcx [ DepKindStruct < ' tcx > ] ,
600
- crate_name : Symbol ,
601
599
output_filenames : OutputFilenames ,
602
600
) -> GlobalCtxt < ' tcx > {
603
601
let data_layout = s. target . parse_data_layout ( ) . unwrap_or_else ( |err| {
@@ -629,7 +627,6 @@ impl<'tcx> TyCtxt<'tcx> {
629
627
pred_rcache : Default :: default ( ) ,
630
628
selection_cache : Default :: default ( ) ,
631
629
evaluation_cache : Default :: default ( ) ,
632
- crate_name,
633
630
data_layout,
634
631
alloc_map : Lock :: new ( interpret:: AllocMap :: new ( ) ) ,
635
632
output_filenames : Arc :: new ( output_filenames) ,
@@ -807,7 +804,7 @@ impl<'tcx> TyCtxt<'tcx> {
807
804
// statements within the query system and we'd run into endless
808
805
// recursion otherwise.
809
806
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 ( ) )
811
808
} else {
812
809
let cstore = & * self . untracked . cstore ;
813
810
( 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 {
2406
2403
pub fn provide ( providers : & mut ty:: query:: Providers ) {
2407
2404
providers. module_reexports =
2408
2405
|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
- } ;
2413
2406
providers. maybe_unused_trait_imports =
2414
2407
|tcx, ( ) | & tcx. resolutions ( ( ) ) . maybe_unused_trait_imports ;
2415
2408
providers. maybe_unused_extern_crates =
0 commit comments