@@ -20,6 +20,7 @@ use rustc::mir::*;
20
20
use rustc:: mir:: visit:: { LvalueContext , Visitor } ;
21
21
22
22
use syntax:: ast;
23
+ use syntax:: symbol:: Symbol ;
23
24
24
25
use std:: rc:: Rc ;
25
26
use util;
@@ -145,7 +146,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
145
146
self . visibility_scope_info [ source_info. scope ] . lint_root ;
146
147
self . register_violations ( & [ UnsafetyViolation {
147
148
source_info,
148
- description : "borrow of packed field" ,
149
+ description : Symbol :: intern ( "borrow of packed field" ) . as_str ( ) ,
149
150
kind : UnsafetyViolationKind :: BorrowPacked ( lint_root)
150
151
} ] , & [ ] ) ;
151
152
}
@@ -209,7 +210,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
209
210
self . visibility_scope_info [ source_info. scope ] . lint_root ;
210
211
self . register_violations ( & [ UnsafetyViolation {
211
212
source_info,
212
- description : "use of extern static" ,
213
+ description : Symbol :: intern ( "use of extern static" ) . as_str ( ) ,
213
214
kind : UnsafetyViolationKind :: ExternStatic ( lint_root)
214
215
} ] , & [ ] ) ;
215
216
}
@@ -225,7 +226,9 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
225
226
{
226
227
let source_info = self . source_info ;
227
228
self . register_violations ( & [ UnsafetyViolation {
228
- source_info, description, kind : UnsafetyViolationKind :: General
229
+ source_info,
230
+ description : Symbol :: intern ( description) . as_str ( ) ,
231
+ kind : UnsafetyViolationKind :: General ,
229
232
} ] , & [ ] ) ;
230
233
}
231
234
@@ -433,15 +436,15 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {
433
436
struct_span_err ! (
434
437
tcx. sess, source_info. span, E0133 ,
435
438
"{} requires unsafe function or block" , description)
436
- . span_label ( source_info. span , description)
439
+ . span_label ( source_info. span , & description[ .. ] )
437
440
. emit ( ) ;
438
441
}
439
442
UnsafetyViolationKind :: ExternStatic ( lint_node_id) => {
440
443
tcx. lint_node ( SAFE_EXTERN_STATICS ,
441
444
lint_node_id,
442
445
source_info. span ,
443
446
& format ! ( "{} requires unsafe function or \
444
- block (error E0133)", description) ) ;
447
+ block (error E0133)", & description[ .. ] ) ) ;
445
448
}
446
449
UnsafetyViolationKind :: BorrowPacked ( lint_node_id) => {
447
450
if let Some ( impl_def_id) = builtin_derive_def_id ( tcx, def_id) {
@@ -451,7 +454,7 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {
451
454
lint_node_id,
452
455
source_info. span ,
453
456
& format ! ( "{} requires unsafe function or \
454
- block (error E0133)", description) ) ;
457
+ block (error E0133)", & description[ .. ] ) ) ;
455
458
}
456
459
}
457
460
}
0 commit comments