@@ -51,7 +51,7 @@ use rustc_macros::HashStable;
51
51
use rustc_query_system:: dep_graph:: DepNodeIndex ;
52
52
use rustc_query_system:: ich:: StableHashingContext ;
53
53
use rustc_serialize:: opaque:: { FileEncodeResult , FileEncoder } ;
54
- use rustc_session:: config:: { CrateType , OutputFilenames } ;
54
+ use rustc_session:: config:: CrateType ;
55
55
use rustc_session:: cstore:: { CrateStoreDyn , Untracked } ;
56
56
use rustc_session:: lint:: Lint ;
57
57
use rustc_session:: Limit ;
@@ -74,7 +74,6 @@ use std::hash::{Hash, Hasher};
74
74
use std:: iter;
75
75
use std:: mem;
76
76
use std:: ops:: { Bound , Deref } ;
77
- use std:: sync:: Arc ;
78
77
79
78
pub trait OnDiskCache < ' tcx > : rustc_data_structures:: sync:: Sync {
80
79
/// Creates a new `OnDiskCache` instance from the serialized data in `data`.
@@ -363,6 +362,9 @@ impl<'tcx> TyCtxt<'tcx> {
363
362
pub fn feed_unit_query ( self ) -> TyCtxtFeed < ' tcx , ( ) > {
364
363
TyCtxtFeed { tcx : self , key : ( ) }
365
364
}
365
+ pub fn feed_local_crate ( self ) -> TyCtxtFeed < ' tcx , CrateNum > {
366
+ TyCtxtFeed { tcx : self , key : LOCAL_CRATE }
367
+ }
366
368
}
367
369
368
370
impl < ' tcx , KEY : Copy > TyCtxtFeed < ' tcx , KEY > {
@@ -428,11 +430,6 @@ pub struct GlobalCtxt<'tcx> {
428
430
pub consts : CommonConsts < ' tcx > ,
429
431
430
432
untracked : Untracked ,
431
- /// Output of the resolver.
432
- pub ( crate ) untracked_resolutions : ty:: ResolverGlobalCtxt ,
433
- /// The entire crate as AST. This field serves as the input for the hir_crate query,
434
- /// which lowers it from AST to HIR. It must not be read or used by anything else.
435
- pub untracked_crate : Steal < Lrc < ast:: Crate > > ,
436
433
437
434
/// This provides access to the incremental compilation on-disk cache for query results.
438
435
/// Do not access this directly. It is only meant to be used by
@@ -457,17 +454,11 @@ pub struct GlobalCtxt<'tcx> {
457
454
/// Merge this with `selection_cache`?
458
455
pub evaluation_cache : traits:: EvaluationCache < ' tcx > ,
459
456
460
- /// The definite name of the current crate after taking into account
461
- /// attributes, commandline parameters, etc.
462
- crate_name : Symbol ,
463
-
464
457
/// Data layout specification for the current target.
465
458
pub data_layout : TargetDataLayout ,
466
459
467
460
/// Stores memory for globals (statics/consts).
468
461
pub ( crate ) alloc_map : Lock < interpret:: AllocMap < ' tcx > > ,
469
-
470
- output_filenames : Arc < OutputFilenames > ,
471
462
}
472
463
473
464
impl < ' tcx > TyCtxt < ' tcx > {
@@ -592,15 +583,11 @@ impl<'tcx> TyCtxt<'tcx> {
592
583
lint_store : Lrc < dyn Any + sync:: Send + sync:: Sync > ,
593
584
arena : & ' tcx WorkerLocal < Arena < ' tcx > > ,
594
585
hir_arena : & ' tcx WorkerLocal < hir:: Arena < ' tcx > > ,
595
- untracked_resolutions : ty:: ResolverGlobalCtxt ,
596
586
untracked : Untracked ,
597
- krate : Lrc < ast:: Crate > ,
598
587
dep_graph : DepGraph ,
599
588
on_disk_cache : Option < & ' tcx dyn OnDiskCache < ' tcx > > ,
600
589
queries : & ' tcx dyn query:: QueryEngine < ' tcx > ,
601
590
query_kinds : & ' tcx [ DepKindStruct < ' tcx > ] ,
602
- crate_name : Symbol ,
603
- output_filenames : OutputFilenames ,
604
591
) -> GlobalCtxt < ' tcx > {
605
592
let data_layout = s. target . parse_data_layout ( ) . unwrap_or_else ( |err| {
606
593
s. emit_fatal ( err) ;
@@ -622,8 +609,6 @@ impl<'tcx> TyCtxt<'tcx> {
622
609
lifetimes : common_lifetimes,
623
610
consts : common_consts,
624
611
untracked,
625
- untracked_resolutions,
626
- untracked_crate : Steal :: new ( krate) ,
627
612
on_disk_cache,
628
613
queries,
629
614
query_caches : query:: QueryCaches :: default ( ) ,
@@ -632,10 +617,8 @@ impl<'tcx> TyCtxt<'tcx> {
632
617
pred_rcache : Default :: default ( ) ,
633
618
selection_cache : Default :: default ( ) ,
634
619
evaluation_cache : Default :: default ( ) ,
635
- crate_name,
636
620
data_layout,
637
621
alloc_map : Lock :: new ( interpret:: AllocMap :: new ( ) ) ,
638
- output_filenames : Arc :: new ( output_filenames) ,
639
622
}
640
623
}
641
624
@@ -810,7 +793,7 @@ impl<'tcx> TyCtxt<'tcx> {
810
793
// statements within the query system and we'd run into endless
811
794
// recursion otherwise.
812
795
let ( crate_name, stable_crate_id) = if def_id. is_local ( ) {
813
- ( self . crate_name , self . sess . local_stable_crate_id ( ) )
796
+ ( self . crate_name ( LOCAL_CRATE ) , self . sess . local_stable_crate_id ( ) )
814
797
} else {
815
798
let cstore = & * self . untracked . cstore ;
816
799
( cstore. crate_name ( def_id. krate ) , cstore. stable_crate_id ( def_id. krate ) )
@@ -2407,13 +2390,8 @@ fn ptr_eq<T, U>(t: *const T, u: *const U) -> bool {
2407
2390
}
2408
2391
2409
2392
pub fn provide ( providers : & mut ty:: query:: Providers ) {
2410
- providers. resolutions = |tcx, ( ) | & tcx. untracked_resolutions ;
2411
2393
providers. module_reexports =
2412
2394
|tcx, id| tcx. resolutions ( ( ) ) . reexport_map . get ( & id) . map ( |v| & v[ ..] ) ;
2413
- providers. crate_name = |tcx, id| {
2414
- assert_eq ! ( id, LOCAL_CRATE ) ;
2415
- tcx. crate_name
2416
- } ;
2417
2395
providers. maybe_unused_trait_imports =
2418
2396
|tcx, ( ) | & tcx. resolutions ( ( ) ) . maybe_unused_trait_imports ;
2419
2397
providers. maybe_unused_extern_crates =
@@ -2424,8 +2402,6 @@ pub fn provide(providers: &mut ty::query::Providers) {
2424
2402
2425
2403
providers. extern_mod_stmt_cnum =
2426
2404
|tcx, id| tcx. resolutions ( ( ) ) . extern_crate_map . get ( & id) . cloned ( ) ;
2427
- providers. output_filenames = |tcx, ( ) | & tcx. output_filenames ;
2428
- providers. features_query = |tcx, ( ) | tcx. sess . features_untracked ( ) ;
2429
2405
providers. is_panic_runtime = |tcx, cnum| {
2430
2406
assert_eq ! ( cnum, LOCAL_CRATE ) ;
2431
2407
tcx. sess . contains_name ( tcx. hir ( ) . krate_attrs ( ) , sym:: panic_runtime)
0 commit comments