@@ -11,12 +11,11 @@ use rustc::mir::interpret::{ConstValue, Allocation, read_target_uint,
11
11
Pointer , ErrorHandled , GlobalId } ;
12
12
use rustc:: mir:: mono:: MonoItem ;
13
13
use rustc:: hir:: Node ;
14
- use syntax_pos:: Span ;
15
14
use rustc_target:: abi:: HasDataLayout ;
16
- use syntax:: symbol:: sym;
17
- use syntax_pos:: symbol:: LocalInternedString ;
18
15
use rustc:: ty:: { self , Ty , Instance } ;
19
16
use rustc_codegen_ssa:: traits:: * ;
17
+ use syntax:: symbol:: { Symbol , sym} ;
18
+ use syntax_pos:: Span ;
20
19
21
20
use rustc:: ty:: layout:: { self , Size , Align , LayoutOf } ;
22
21
@@ -104,10 +103,11 @@ fn check_and_apply_linkage(
104
103
cx : & CodegenCx < ' ll , ' tcx > ,
105
104
attrs : & CodegenFnAttrs ,
106
105
ty : Ty < ' tcx > ,
107
- sym : LocalInternedString ,
106
+ sym : Symbol ,
108
107
span : Span
109
108
) -> & ' ll Value {
110
109
let llty = cx. layout_of ( ty) . llvm_type ( cx) ;
110
+ let sym = sym. as_str ( ) ;
111
111
if let Some ( linkage) = attrs. linkage {
112
112
debug ! ( "get_static: sym={} linkage={:?}" , sym, linkage) ;
113
113
@@ -203,7 +203,7 @@ impl CodegenCx<'ll, 'tcx> {
203
203
def_id) ;
204
204
205
205
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 ( ) ;
207
207
208
208
debug ! ( "get_static: sym={} instance={:?}" , sym, instance) ;
209
209
@@ -214,11 +214,12 @@ impl CodegenCx<'ll, 'tcx> {
214
214
Node :: Item ( & hir:: Item {
215
215
ref attrs, span, node : hir:: ItemKind :: Static ( ..) , ..
216
216
} ) => {
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 ( ) {
218
219
span_bug ! ( span, "Conflicting symbol names for static?" ) ;
219
220
}
220
221
221
- let g = self . define_global ( & sym [ .. ] , llty) . unwrap ( ) ;
222
+ let g = self . define_global ( & sym_str , llty) . unwrap ( ) ;
222
223
223
224
if !self . tcx . is_reachable_non_generic ( def_id) {
224
225
unsafe {
0 commit comments