@@ -51,7 +51,7 @@ use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap,
5151 StableVec } ;
5252use arena:: { TypedArena , SyncDroplessArena } ;
5353use rustc_data_structures:: indexed_vec:: { Idx , IndexVec } ;
54- use rustc_data_structures:: sync:: { Lrc , Lock , WorkerLocal , AtomicOnce , Once , OneThread } ;
54+ use rustc_data_structures:: sync:: { self , Lrc , Lock , WorkerLocal , AtomicOnce , Once } ;
5555use std:: any:: Any ;
5656use std:: borrow:: Borrow ;
5757use std:: cmp:: Ordering ;
@@ -70,7 +70,7 @@ use syntax::attr;
7070use syntax:: source_map:: MultiSpan ;
7171use syntax:: edition:: Edition ;
7272use syntax:: feature_gate;
73- use syntax:: symbol:: { Symbol , keywords, InternedString } ;
73+ use syntax:: symbol:: { keywords, InternedString } ;
7474use syntax_pos:: Span ;
7575
7676use crate :: hir;
@@ -1021,13 +1021,10 @@ pub struct GlobalCtxt<'tcx> {
10211021
10221022 /// This stores a `Lrc<CStore>`, but that type depends on
10231023 /// rustc_metadata, so it cannot be used here.
1024- pub cstore_rc : OneThread < Steal < Box < dyn Any > > > ,
1024+ pub cstore_rc : & ' tcx ( dyn Any + sync :: Sync ) ,
10251025
10261026 pub sess_rc : Lrc < Session > ,
10271027
1028- /// The AST after registering plugins.
1029- pub ast_crate : Steal < ( ast:: Crate , ty:: PluginInfo ) > ,
1030-
10311028 lowered_hir : AtomicOnce < & ' tcx hir:: LoweredHir > ,
10321029 hir_map : AtomicOnce < & ' tcx hir_map:: Map < ' tcx > > ,
10331030
@@ -1047,9 +1044,7 @@ pub struct GlobalCtxt<'tcx> {
10471044 /// Merge this with `selection_cache`?
10481045 pub evaluation_cache : traits:: EvaluationCache < ' tcx > ,
10491046
1050- /// The definite name of the current crate after taking into account
1051- /// attributes, commandline parameters, etc.
1052- pub crate_name : Symbol ,
1047+ pub crate_name_override : Option < String > ,
10531048
10541049 /// Data layout specification for the current target.
10551050 pub data_layout : TargetDataLayout ,
@@ -1210,15 +1205,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12101205 pub fn create_global_ctxt (
12111206 s : & ' tcx Lrc < Session > ,
12121207 cstore : & ' tcx CrateStoreDyn ,
1213- cstore_rc : Box < dyn Any > ,
1208+ cstore_rc : & ' tcx ( dyn Any + sync :: Sync ) ,
12141209 local_providers : ty:: query:: Providers < ' tcx > ,
12151210 extern_providers : ty:: query:: Providers < ' tcx > ,
12161211 arenas : & ' tcx AllArenas < ' tcx > ,
12171212 dep_graph : DepGraph ,
1218- ast_crate : ast:: Crate ,
1219- plugin_info : ty:: PluginInfo ,
12201213 on_disk_query_result_cache : query:: OnDiskCache < ' tcx > ,
1221- crate_name : & str ,
1214+ crate_name : Option < String > ,
12221215 tx : mpsc:: Sender < Box < dyn Any + Send > > ,
12231216 io : InputsAndOutputs ,
12241217 ) -> GlobalCtxt < ' tcx > {
@@ -1234,13 +1227,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12341227 GlobalCtxt {
12351228 sess : & * * s,
12361229 cstore,
1237- cstore_rc : OneThread :: new ( Steal :: new ( cstore_rc ) ) ,
1230+ cstore_rc,
12381231 sess_rc : s. clone ( ) ,
12391232 global_arenas : & arenas. global ,
12401233 global_interners : interners,
12411234 dep_graph,
12421235 types : common_types,
1243- ast_crate : Steal :: new ( ( ast_crate, plugin_info) ) ,
12441236 lowered_hir : AtomicOnce :: new ( ) ,
12451237 hir_map : AtomicOnce :: new ( ) ,
12461238 metadata_dep_nodes : Once :: new ( ) ,
@@ -1252,7 +1244,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12521244 rcache : Default :: default ( ) ,
12531245 selection_cache : Default :: default ( ) ,
12541246 evaluation_cache : Default :: default ( ) ,
1255- crate_name : Symbol :: intern ( crate_name) ,
1247+ crate_name_override : crate_name,
12561248 data_layout,
12571249 layout_interner : Default :: default ( ) ,
12581250 stability_interner : Default :: default ( ) ,
@@ -1361,7 +1353,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
13611353 // statements within the query system and we'd run into endless
13621354 // recursion otherwise.
13631355 let ( crate_name, crate_disambiguator) = if def_id. is_local ( ) {
1364- ( self . crate_name . clone ( ) ,
1356+ ( self . crate_name ( LOCAL_CRATE ) ,
13651357 self . sess . local_crate_disambiguator ( ) )
13661358 } else {
13671359 ( self . cstore . crate_name_untracked ( def_id. krate ) ,
@@ -3008,7 +3000,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
30083000 } ;
30093001 providers. crate_name = |tcx, id| {
30103002 assert_eq ! ( id, LOCAL_CRATE ) ;
3011- tcx. crate_name
3003+ tcx. early_crate_name ( LocalCrate ) . unwrap ( )
30123004 } ;
30133005 providers. get_lib_features = |tcx, id| {
30143006 assert_eq ! ( id, LOCAL_CRATE ) ;
0 commit comments