@@ -51,7 +51,7 @@ use rustc_macros::HashStable;
5151use rustc_query_system:: dep_graph:: DepNodeIndex ;
5252use rustc_query_system:: ich:: StableHashingContext ;
5353use rustc_serialize:: opaque:: { FileEncodeResult , FileEncoder } ;
54- use rustc_session:: config:: { CrateType , OutputFilenames } ;
54+ use rustc_session:: config:: CrateType ;
5555use rustc_session:: cstore:: { CrateStoreDyn , Untracked } ;
5656use rustc_session:: lint:: Lint ;
5757use rustc_session:: Limit ;
@@ -74,7 +74,6 @@ use std::hash::{Hash, Hasher};
7474use std:: iter;
7575use std:: mem;
7676use std:: ops:: { Bound , Deref } ;
77- use std:: sync:: Arc ;
7877
7978pub trait OnDiskCache < ' tcx > : rustc_data_structures:: sync:: Sync {
8079 /// Creates a new `OnDiskCache` instance from the serialized data in `data`.
@@ -363,6 +362,9 @@ impl<'tcx> TyCtxt<'tcx> {
363362 pub fn feed_unit_query ( self ) -> TyCtxtFeed < ' tcx , ( ) > {
364363 TyCtxtFeed { tcx : self , key : ( ) }
365364 }
365+ pub fn feed_local_crate ( self ) -> TyCtxtFeed < ' tcx , CrateNum > {
366+ TyCtxtFeed { tcx : self , key : LOCAL_CRATE }
367+ }
366368}
367369
368370impl < ' tcx , KEY : Copy > TyCtxtFeed < ' tcx , KEY > {
@@ -428,11 +430,6 @@ pub struct GlobalCtxt<'tcx> {
428430 pub consts : CommonConsts < ' tcx > ,
429431
430432 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 > > ,
436433
437434 /// This provides access to the incremental compilation on-disk cache for query results.
438435 /// Do not access this directly. It is only meant to be used by
@@ -457,17 +454,11 @@ pub struct GlobalCtxt<'tcx> {
457454 /// Merge this with `selection_cache`?
458455 pub evaluation_cache : traits:: EvaluationCache < ' tcx > ,
459456
460- /// The definite name of the current crate after taking into account
461- /// attributes, commandline parameters, etc.
462- crate_name : Symbol ,
463-
464457 /// Data layout specification for the current target.
465458 pub data_layout : TargetDataLayout ,
466459
467460 /// Stores memory for globals (statics/consts).
468461 pub ( crate ) alloc_map : Lock < interpret:: AllocMap < ' tcx > > ,
469-
470- output_filenames : Arc < OutputFilenames > ,
471462}
472463
473464impl < ' tcx > TyCtxt < ' tcx > {
@@ -592,15 +583,11 @@ impl<'tcx> TyCtxt<'tcx> {
592583 lint_store : Lrc < dyn Any + sync:: Send + sync:: Sync > ,
593584 arena : & ' tcx WorkerLocal < Arena < ' tcx > > ,
594585 hir_arena : & ' tcx WorkerLocal < hir:: Arena < ' tcx > > ,
595- untracked_resolutions : ty:: ResolverGlobalCtxt ,
596586 untracked : Untracked ,
597- krate : Lrc < ast:: Crate > ,
598587 dep_graph : DepGraph ,
599588 on_disk_cache : Option < & ' tcx dyn OnDiskCache < ' tcx > > ,
600589 queries : & ' tcx dyn query:: QueryEngine < ' tcx > ,
601590 query_kinds : & ' tcx [ DepKindStruct < ' tcx > ] ,
602- crate_name : Symbol ,
603- output_filenames : OutputFilenames ,
604591 ) -> GlobalCtxt < ' tcx > {
605592 let data_layout = s. target . parse_data_layout ( ) . unwrap_or_else ( |err| {
606593 s. emit_fatal ( err) ;
@@ -622,8 +609,6 @@ impl<'tcx> TyCtxt<'tcx> {
622609 lifetimes : common_lifetimes,
623610 consts : common_consts,
624611 untracked,
625- untracked_resolutions,
626- untracked_crate : Steal :: new ( krate) ,
627612 on_disk_cache,
628613 queries,
629614 query_caches : query:: QueryCaches :: default ( ) ,
@@ -632,10 +617,8 @@ impl<'tcx> TyCtxt<'tcx> {
632617 pred_rcache : Default :: default ( ) ,
633618 selection_cache : Default :: default ( ) ,
634619 evaluation_cache : Default :: default ( ) ,
635- crate_name,
636620 data_layout,
637621 alloc_map : Lock :: new ( interpret:: AllocMap :: new ( ) ) ,
638- output_filenames : Arc :: new ( output_filenames) ,
639622 }
640623 }
641624
@@ -810,7 +793,7 @@ impl<'tcx> TyCtxt<'tcx> {
810793 // statements within the query system and we'd run into endless
811794 // recursion otherwise.
812795 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 ( ) )
814797 } else {
815798 let cstore = & * self . untracked . cstore ;
816799 ( 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 {
24072390}
24082391
24092392pub fn provide ( providers : & mut ty:: query:: Providers ) {
2410- providers. resolutions = |tcx, ( ) | & tcx. untracked_resolutions ;
24112393 providers. module_reexports =
24122394 |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- } ;
24172395 providers. maybe_unused_trait_imports =
24182396 |tcx, ( ) | & tcx. resolutions ( ( ) ) . maybe_unused_trait_imports ;
24192397 providers. maybe_unused_extern_crates =
@@ -2424,8 +2402,6 @@ pub fn provide(providers: &mut ty::query::Providers) {
24242402
24252403 providers. extern_mod_stmt_cnum =
24262404 |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 ( ) ;
24292405 providers. is_panic_runtime = |tcx, cnum| {
24302406 assert_eq ! ( cnum, LOCAL_CRATE ) ;
24312407 tcx. sess . contains_name ( tcx. hir ( ) . krate_attrs ( ) , sym:: panic_runtime)
0 commit comments