@@ -17,7 +17,7 @@ use rustc_middle::mir::interpret::{
17
17
} ;
18
18
use rustc_middle:: mir:: mono:: MonoItem ;
19
19
use rustc_middle:: ty:: layout:: LayoutOf ;
20
- use rustc_middle:: ty:: { self , Instance , Ty } ;
20
+ use rustc_middle:: ty:: { self , Instance } ;
21
21
use rustc_middle:: { bug, span_bug} ;
22
22
use rustc_session:: config:: Lto ;
23
23
use rustc_target:: abi:: {
@@ -147,11 +147,10 @@ fn set_global_alignment<'ll>(cx: &CodegenCx<'ll, '_>, gv: &'ll Value, mut align:
147
147
fn check_and_apply_linkage < ' ll , ' tcx > (
148
148
cx : & CodegenCx < ' ll , ' tcx > ,
149
149
attrs : & CodegenFnAttrs ,
150
- ty : Ty < ' tcx > ,
150
+ llty : & ' ll Type ,
151
151
sym : & str ,
152
152
def_id : DefId ,
153
153
) -> & ' ll Value {
154
- let llty = cx. layout_of ( ty) . llvm_type ( cx) ;
155
154
if let Some ( linkage) = attrs. import_linkage {
156
155
debug ! ( "get_static: sym={} linkage={:?}" , sym, linkage) ;
157
156
@@ -245,9 +244,9 @@ impl<'ll> CodegenCx<'ll, '_> {
245
244
let fn_attrs = self . tcx . codegen_fn_attrs ( def_id) ;
246
245
247
246
debug ! ( "get_static: sym={} instance={:?} fn_attrs={:?}" , sym, instance, fn_attrs) ;
247
+ let llty = self . layout_of ( ty) . llvm_type ( self ) ;
248
248
249
249
let g = if def_id. is_local ( ) && !self . tcx . is_foreign_item ( def_id) {
250
- let llty = self . layout_of ( ty) . llvm_type ( self ) ;
251
250
if let Some ( g) = self . get_declared_value ( sym) {
252
251
if self . val_ty ( g) != self . type_ptr ( ) {
253
252
span_bug ! ( self . tcx. def_span( def_id) , "Conflicting types for static" ) ;
@@ -264,7 +263,7 @@ impl<'ll> CodegenCx<'ll, '_> {
264
263
265
264
g
266
265
} else {
267
- check_and_apply_linkage ( self , fn_attrs, ty , sym, def_id)
266
+ check_and_apply_linkage ( self , fn_attrs, llty , sym, def_id)
268
267
} ;
269
268
270
269
// Thread-local statics in some other crate need to *always* be linked
0 commit comments