@@ -51,7 +51,7 @@ use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap,
51
51
StableVec } ;
52
52
use arena:: { TypedArena , SyncDroplessArena } ;
53
53
use 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 } ;
55
55
use std:: any:: Any ;
56
56
use std:: borrow:: Borrow ;
57
57
use std:: cmp:: Ordering ;
@@ -70,7 +70,7 @@ use syntax::attr;
70
70
use syntax:: source_map:: MultiSpan ;
71
71
use syntax:: edition:: Edition ;
72
72
use syntax:: feature_gate;
73
- use syntax:: symbol:: { Symbol , keywords, InternedString } ;
73
+ use syntax:: symbol:: { keywords, InternedString } ;
74
74
use syntax_pos:: Span ;
75
75
76
76
use crate :: hir;
@@ -1021,13 +1021,10 @@ pub struct GlobalCtxt<'tcx> {
1021
1021
1022
1022
/// This stores a `Lrc<CStore>`, but that type depends on
1023
1023
/// 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 ) ,
1025
1025
1026
1026
pub sess_rc : Lrc < Session > ,
1027
1027
1028
- /// The AST after registering plugins.
1029
- pub ast_crate : Steal < ( ast:: Crate , ty:: PluginInfo ) > ,
1030
-
1031
1028
lowered_hir : AtomicOnce < & ' tcx hir:: LoweredHir > ,
1032
1029
hir_map : AtomicOnce < & ' tcx hir_map:: Map < ' tcx > > ,
1033
1030
@@ -1047,9 +1044,7 @@ pub struct GlobalCtxt<'tcx> {
1047
1044
/// Merge this with `selection_cache`?
1048
1045
pub evaluation_cache : traits:: EvaluationCache < ' tcx > ,
1049
1046
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 > ,
1053
1048
1054
1049
/// Data layout specification for the current target.
1055
1050
pub data_layout : TargetDataLayout ,
@@ -1210,15 +1205,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1210
1205
pub fn create_global_ctxt (
1211
1206
s : & ' tcx Lrc < Session > ,
1212
1207
cstore : & ' tcx CrateStoreDyn ,
1213
- cstore_rc : Box < dyn Any > ,
1208
+ cstore_rc : & ' tcx ( dyn Any + sync :: Sync ) ,
1214
1209
local_providers : ty:: query:: Providers < ' tcx > ,
1215
1210
extern_providers : ty:: query:: Providers < ' tcx > ,
1216
1211
arenas : & ' tcx AllArenas < ' tcx > ,
1217
1212
dep_graph : DepGraph ,
1218
- ast_crate : ast:: Crate ,
1219
- plugin_info : ty:: PluginInfo ,
1220
1213
on_disk_query_result_cache : query:: OnDiskCache < ' tcx > ,
1221
- crate_name : & str ,
1214
+ crate_name : Option < String > ,
1222
1215
tx : mpsc:: Sender < Box < dyn Any + Send > > ,
1223
1216
io : InputsAndOutputs ,
1224
1217
) -> GlobalCtxt < ' tcx > {
@@ -1234,13 +1227,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1234
1227
GlobalCtxt {
1235
1228
sess : & * * s,
1236
1229
cstore,
1237
- cstore_rc : OneThread :: new ( Steal :: new ( cstore_rc ) ) ,
1230
+ cstore_rc,
1238
1231
sess_rc : s. clone ( ) ,
1239
1232
global_arenas : & arenas. global ,
1240
1233
global_interners : interners,
1241
1234
dep_graph,
1242
1235
types : common_types,
1243
- ast_crate : Steal :: new ( ( ast_crate, plugin_info) ) ,
1244
1236
lowered_hir : AtomicOnce :: new ( ) ,
1245
1237
hir_map : AtomicOnce :: new ( ) ,
1246
1238
metadata_dep_nodes : Once :: new ( ) ,
@@ -1252,7 +1244,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1252
1244
rcache : Default :: default ( ) ,
1253
1245
selection_cache : Default :: default ( ) ,
1254
1246
evaluation_cache : Default :: default ( ) ,
1255
- crate_name : Symbol :: intern ( crate_name) ,
1247
+ crate_name_override : crate_name,
1256
1248
data_layout,
1257
1249
layout_interner : Default :: default ( ) ,
1258
1250
stability_interner : Default :: default ( ) ,
@@ -1361,7 +1353,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1361
1353
// statements within the query system and we'd run into endless
1362
1354
// recursion otherwise.
1363
1355
let ( crate_name, crate_disambiguator) = if def_id. is_local ( ) {
1364
- ( self . crate_name . clone ( ) ,
1356
+ ( self . crate_name ( LOCAL_CRATE ) ,
1365
1357
self . sess . local_crate_disambiguator ( ) )
1366
1358
} else {
1367
1359
( self . cstore . crate_name_untracked ( def_id. krate ) ,
@@ -3008,7 +3000,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
3008
3000
} ;
3009
3001
providers. crate_name = |tcx, id| {
3010
3002
assert_eq ! ( id, LOCAL_CRATE ) ;
3011
- tcx. crate_name
3003
+ tcx. early_crate_name ( LocalCrate ) . unwrap ( )
3012
3004
} ;
3013
3005
providers. get_lib_features = |tcx, id| {
3014
3006
assert_eq ! ( id, LOCAL_CRATE ) ;
0 commit comments