@@ -203,35 +203,8 @@ impl CodegenCx<'ll, 'tcx> {
203
203
gv
204
204
}
205
205
}
206
- }
207
-
208
- impl StaticMethods for CodegenCx < ' ll , ' tcx > {
209
- fn static_addr_of (
210
- & self ,
211
- cv : & ' ll Value ,
212
- align : Align ,
213
- kind : Option < & str > ,
214
- ) -> & ' ll Value {
215
- if let Some ( & gv) = self . const_globals . borrow ( ) . get ( & cv) {
216
- unsafe {
217
- // Upgrade the alignment in cases where the same constant is used with different
218
- // alignment requirements
219
- let llalign = align. bytes ( ) as u32 ;
220
- if llalign > llvm:: LLVMGetAlignment ( gv) {
221
- llvm:: LLVMSetAlignment ( gv, llalign) ;
222
- }
223
- }
224
- return gv;
225
- }
226
- let gv = self . static_addr_of_mut ( cv, align, kind) ;
227
- unsafe {
228
- llvm:: LLVMSetGlobalConstant ( gv, True ) ;
229
- }
230
- self . const_globals . borrow_mut ( ) . insert ( cv, gv) ;
231
- gv
232
- }
233
206
234
- fn get_static ( & self , def_id : DefId ) -> & ' ll Value {
207
+ crate fn get_static ( & self , def_id : DefId ) -> & ' ll Value {
235
208
let instance = Instance :: mono ( self . tcx , def_id) ;
236
209
if let Some ( & g) = self . instances . borrow ( ) . get ( & instance) {
237
210
return g;
@@ -351,6 +324,33 @@ impl StaticMethods for CodegenCx<'ll, 'tcx> {
351
324
self . instances . borrow_mut ( ) . insert ( instance, g) ;
352
325
g
353
326
}
327
+ }
328
+
329
+ impl StaticMethods for CodegenCx < ' ll , ' tcx > {
330
+ fn static_addr_of (
331
+ & self ,
332
+ cv : & ' ll Value ,
333
+ align : Align ,
334
+ kind : Option < & str > ,
335
+ ) -> & ' ll Value {
336
+ if let Some ( & gv) = self . const_globals . borrow ( ) . get ( & cv) {
337
+ unsafe {
338
+ // Upgrade the alignment in cases where the same constant is used with different
339
+ // alignment requirements
340
+ let llalign = align. bytes ( ) as u32 ;
341
+ if llalign > llvm:: LLVMGetAlignment ( gv) {
342
+ llvm:: LLVMSetAlignment ( gv, llalign) ;
343
+ }
344
+ }
345
+ return gv;
346
+ }
347
+ let gv = self . static_addr_of_mut ( cv, align, kind) ;
348
+ unsafe {
349
+ llvm:: LLVMSetGlobalConstant ( gv, True ) ;
350
+ }
351
+ self . const_globals . borrow_mut ( ) . insert ( cv, gv) ;
352
+ gv
353
+ }
354
354
355
355
fn codegen_static (
356
356
& self ,
0 commit comments