@@ -20,6 +20,7 @@ use rustc::mir::*;
2020use rustc:: mir:: visit:: { LvalueContext , Visitor } ;
2121
2222use syntax:: ast;
23+ use syntax:: symbol:: Symbol ;
2324
2425use std:: rc:: Rc ;
2526use util;
@@ -145,7 +146,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
145146 self . visibility_scope_info [ source_info. scope ] . lint_root ;
146147 self . register_violations ( & [ UnsafetyViolation {
147148 source_info,
148- description : "borrow of packed field" ,
149+ description : Symbol :: intern ( "borrow of packed field" ) . as_str ( ) ,
149150 kind : UnsafetyViolationKind :: BorrowPacked ( lint_root)
150151 } ] , & [ ] ) ;
151152 }
@@ -209,7 +210,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
209210 self . visibility_scope_info [ source_info. scope ] . lint_root ;
210211 self . register_violations ( & [ UnsafetyViolation {
211212 source_info,
212- description : "use of extern static" ,
213+ description : Symbol :: intern ( "use of extern static" ) . as_str ( ) ,
213214 kind : UnsafetyViolationKind :: ExternStatic ( lint_root)
214215 } ] , & [ ] ) ;
215216 }
@@ -225,7 +226,9 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
225226 {
226227 let source_info = self . source_info ;
227228 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 ,
229232 } ] , & [ ] ) ;
230233 }
231234
@@ -433,15 +436,15 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {
433436 struct_span_err ! (
434437 tcx. sess, source_info. span, E0133 ,
435438 "{} requires unsafe function or block" , description)
436- . span_label ( source_info. span , description)
439+ . span_label ( source_info. span , & description[ .. ] )
437440 . emit ( ) ;
438441 }
439442 UnsafetyViolationKind :: ExternStatic ( lint_node_id) => {
440443 tcx. lint_node ( SAFE_EXTERN_STATICS ,
441444 lint_node_id,
442445 source_info. span ,
443446 & format ! ( "{} requires unsafe function or \
444- block (error E0133)", description) ) ;
447+ block (error E0133)", & description[ .. ] ) ) ;
445448 }
446449 UnsafetyViolationKind :: BorrowPacked ( lint_node_id) => {
447450 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) {
451454 lint_node_id,
452455 source_info. span ,
453456 & format ! ( "{} requires unsafe function or \
454- block (error E0133)", description) ) ;
457+ block (error E0133)", & description[ .. ] ) ) ;
455458 }
456459 }
457460 }
0 commit comments