@@ -17,7 +17,7 @@ use rustc_middle::mir::interpret::{
1717} ;
1818use rustc_middle:: mir:: mono:: MonoItem ;
1919use rustc_middle:: ty:: layout:: LayoutOf ;
20- use rustc_middle:: ty:: { self , Instance , Ty } ;
20+ use rustc_middle:: ty:: { self , Instance } ;
2121use rustc_middle:: { bug, span_bug} ;
2222use rustc_session:: config:: Lto ;
2323use rustc_target:: abi:: {
@@ -147,11 +147,10 @@ fn set_global_alignment<'ll>(cx: &CodegenCx<'ll, '_>, gv: &'ll Value, mut align:
147147fn check_and_apply_linkage < ' ll , ' tcx > (
148148 cx : & CodegenCx < ' ll , ' tcx > ,
149149 attrs : & CodegenFnAttrs ,
150- ty : Ty < ' tcx > ,
150+ llty : & ' ll Type ,
151151 sym : & str ,
152152 def_id : DefId ,
153153) -> & ' ll Value {
154- let llty = cx. layout_of ( ty) . llvm_type ( cx) ;
155154 if let Some ( linkage) = attrs. import_linkage {
156155 debug ! ( "get_static: sym={} linkage={:?}" , sym, linkage) ;
157156
@@ -245,9 +244,9 @@ impl<'ll> CodegenCx<'ll, '_> {
245244 let fn_attrs = self . tcx . codegen_fn_attrs ( def_id) ;
246245
247246 debug ! ( "get_static: sym={} instance={:?} fn_attrs={:?}" , sym, instance, fn_attrs) ;
247+ let llty = self . layout_of ( ty) . llvm_type ( self ) ;
248248
249249 let g = if def_id. is_local ( ) && !self . tcx . is_foreign_item ( def_id) {
250- let llty = self . layout_of ( ty) . llvm_type ( self ) ;
251250 if let Some ( g) = self . get_declared_value ( sym) {
252251 if self . val_ty ( g) != self . type_ptr ( ) {
253252 span_bug ! ( self . tcx. def_span( def_id) , "Conflicting types for static" ) ;
@@ -264,7 +263,7 @@ impl<'ll> CodegenCx<'ll, '_> {
264263
265264 g
266265 } 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)
268267 } ;
269268
270269 // Thread-local statics in some other crate need to *always* be linked
0 commit comments