@@ -2,7 +2,7 @@ use std::borrow::Borrow;
2
2
use std:: cell:: { Cell , RefCell } ;
3
3
use std:: ffi:: { CStr , c_char, c_uint} ;
4
4
use std:: marker:: PhantomData ;
5
- use std:: ops:: Deref ;
5
+ use std:: ops:: { Deref , DerefMut } ;
6
6
use std:: str;
7
7
8
8
use rustc_abi:: { HasDataLayout , Size , TargetDataLayout , VariantIdx } ;
@@ -77,6 +77,13 @@ impl<'ll, T: Borrow<SCx<'ll>>> Deref for GenericCx<'ll, T> {
77
77
}
78
78
}
79
79
80
+ impl < ' ll , T : Borrow < SCx < ' ll > > > DerefMut for GenericCx < ' ll , T > {
81
+ #[ inline]
82
+ fn deref_mut ( & mut self ) -> & mut Self :: Target {
83
+ & mut self . 0
84
+ }
85
+ }
86
+
80
87
pub ( crate ) type SimpleCx < ' ll > = GenericCx < ' ll , SCx < ' ll > > ;
81
88
82
89
/// There is one `CodegenCx` per codegen unit. Each one has its own LLVM
@@ -110,11 +117,11 @@ pub(crate) struct FullCx<'ll, 'tcx> {
110
117
111
118
/// Statics that will be placed in the llvm.used variable
112
119
/// See <https://llvm.org/docs/LangRef.html#the-llvm-used-global-variable> for details
113
- pub used_statics : RefCell < Vec < & ' ll Value > > ,
120
+ pub used_statics : Vec < & ' ll Value > ,
114
121
115
122
/// Statics that will be placed in the llvm.compiler.used variable
116
123
/// See <https://llvm.org/docs/LangRef.html#the-llvm-compiler-used-global-variable> for details
117
- pub compiler_used_statics : RefCell < Vec < & ' ll Value > > ,
124
+ pub compiler_used_statics : Vec < & ' ll Value > ,
118
125
119
126
/// Mapping of non-scalar types to llvm types.
120
127
pub type_lowering : RefCell < FxHashMap < ( Ty < ' tcx > , Option < VariantIdx > ) , & ' ll Type > > ,
@@ -606,8 +613,8 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
606
613
const_str_cache : Default :: default ( ) ,
607
614
const_globals : Default :: default ( ) ,
608
615
statics_to_rauw : RefCell :: new ( Vec :: new ( ) ) ,
609
- used_statics : RefCell :: new ( Vec :: new ( ) ) ,
610
- compiler_used_statics : RefCell :: new ( Vec :: new ( ) ) ,
616
+ used_statics : Vec :: new ( ) ,
617
+ compiler_used_statics : Vec :: new ( ) ,
611
618
type_lowering : Default :: default ( ) ,
612
619
scalar_lltypes : Default :: default ( ) ,
613
620
coverage_cx,
0 commit comments