@@ -70,6 +70,8 @@ pub struct CStore {
70
70
71
71
/// Unused externs of the crate
72
72
unused_externs : Vec < Symbol > ,
73
+
74
+ used_extern_options : FxHashSet < Symbol > ,
73
75
}
74
76
75
77
impl std:: fmt:: Debug for CStore {
@@ -83,7 +85,6 @@ pub struct CrateLoader<'a, 'tcx: 'a> {
83
85
tcx : TyCtxt < ' tcx > ,
84
86
// Mutable output.
85
87
cstore : & ' a mut CStore ,
86
- used_extern_options : & ' a mut FxHashSet < Symbol > ,
87
88
}
88
89
89
90
impl < ' a , ' tcx > std:: ops:: Deref for CrateLoader < ' a , ' tcx > {
@@ -495,17 +496,14 @@ impl CStore {
495
496
has_global_allocator : false ,
496
497
has_alloc_error_handler : false ,
497
498
unused_externs : Vec :: new ( ) ,
499
+ used_extern_options : Default :: default ( ) ,
498
500
}
499
501
}
500
502
}
501
503
502
504
impl < ' a , ' tcx > CrateLoader < ' a , ' tcx > {
503
- pub fn new (
504
- tcx : TyCtxt < ' tcx > ,
505
- cstore : & ' a mut CStore ,
506
- used_extern_options : & ' a mut FxHashSet < Symbol > ,
507
- ) -> Self {
508
- CrateLoader { tcx, cstore, used_extern_options }
505
+ pub fn new ( tcx : TyCtxt < ' tcx > , cstore : & ' a mut CStore ) -> Self {
506
+ CrateLoader { tcx, cstore }
509
507
}
510
508
511
509
fn existing_match ( & self , name : Symbol , hash : Option < Svh > , kind : PathKind ) -> Option < CrateNum > {
@@ -753,7 +751,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
753
751
dep_kind : CrateDepKind ,
754
752
origin : CrateOrigin < ' _ > ,
755
753
) -> Option < CrateNum > {
756
- self . used_extern_options . insert ( name) ;
754
+ self . cstore . used_extern_options . insert ( name) ;
757
755
match self . maybe_resolve_crate ( name, dep_kind, origin) {
758
756
Ok ( cnum) => {
759
757
self . cstore . set_used_recursively ( cnum) ;
@@ -1143,7 +1141,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
1143
1141
for ( name, entry) in self . sess . opts . externs . iter ( ) {
1144
1142
if entry. force {
1145
1143
let name_interned = Symbol :: intern ( name) ;
1146
- if !self . used_extern_options . contains ( & name_interned) {
1144
+ if !self . cstore . used_extern_options . contains ( & name_interned) {
1147
1145
self . resolve_crate (
1148
1146
name_interned,
1149
1147
DUMMY_SP ,
@@ -1206,7 +1204,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
1206
1204
continue ;
1207
1205
}
1208
1206
let name_interned = Symbol :: intern ( name) ;
1209
- if self . used_extern_options . contains ( & name_interned) {
1207
+ if self . cstore . used_extern_options . contains ( & name_interned) {
1210
1208
continue ;
1211
1209
}
1212
1210
0 commit comments