@@ -11,12 +11,11 @@ use rustc::mir::interpret::{ConstValue, Allocation, read_target_uint,
1111 Pointer , ErrorHandled , GlobalId } ;
1212use rustc:: mir:: mono:: MonoItem ;
1313use rustc:: hir:: Node ;
14- use syntax_pos:: Span ;
1514use rustc_target:: abi:: HasDataLayout ;
16- use syntax:: symbol:: sym;
17- use syntax_pos:: symbol:: LocalInternedString ;
1815use rustc:: ty:: { self , Ty , Instance } ;
1916use rustc_codegen_ssa:: traits:: * ;
17+ use syntax:: symbol:: { Symbol , sym} ;
18+ use syntax_pos:: Span ;
2019
2120use rustc:: ty:: layout:: { self , Size , Align , LayoutOf } ;
2221
@@ -104,10 +103,11 @@ fn check_and_apply_linkage(
104103 cx : & CodegenCx < ' ll , ' tcx > ,
105104 attrs : & CodegenFnAttrs ,
106105 ty : Ty < ' tcx > ,
107- sym : LocalInternedString ,
106+ sym : Symbol ,
108107 span : Span
109108) -> & ' ll Value {
110109 let llty = cx. layout_of ( ty) . llvm_type ( cx) ;
110+ let sym = sym. as_str ( ) ;
111111 if let Some ( linkage) = attrs. linkage {
112112 debug ! ( "get_static: sym={} linkage={:?}" , sym, linkage) ;
113113
@@ -203,7 +203,7 @@ impl CodegenCx<'ll, 'tcx> {
203203 def_id) ;
204204
205205 let ty = instance. ty ( self . tcx ) ;
206- let sym = self . tcx . symbol_name ( instance) . name . as_str ( ) ;
206+ let sym = self . tcx . symbol_name ( instance) . name . as_symbol ( ) ;
207207
208208 debug ! ( "get_static: sym={} instance={:?}" , sym, instance) ;
209209
@@ -214,11 +214,12 @@ impl CodegenCx<'ll, 'tcx> {
214214 Node :: Item ( & hir:: Item {
215215 ref attrs, span, node : hir:: ItemKind :: Static ( ..) , ..
216216 } ) => {
217- if self . get_declared_value ( & sym[ ..] ) . is_some ( ) {
217+ let sym_str = sym. as_str ( ) ;
218+ if self . get_declared_value ( & sym_str) . is_some ( ) {
218219 span_bug ! ( span, "Conflicting symbol names for static?" ) ;
219220 }
220221
221- let g = self . define_global ( & sym [ .. ] , llty) . unwrap ( ) ;
222+ let g = self . define_global ( & sym_str , llty) . unwrap ( ) ;
222223
223224 if !self . tcx . is_reachable_non_generic ( def_id) {
224225 unsafe {
0 commit comments