@@ -12,7 +12,7 @@ use rustc::lint::builtin::{SAFE_EXTERN_STATICS, SAFE_PACKED_BORROWS, UNUSED_UNSA
12
12
use rustc:: mir:: * ;
13
13
use rustc:: mir:: visit:: { PlaceContext , Visitor , MutatingUseContext } ;
14
14
15
- use syntax:: symbol:: { Symbol , sym} ;
15
+ use syntax:: symbol:: { InternedString , sym} ;
16
16
17
17
use std:: ops:: Bound ;
18
18
@@ -167,9 +167,9 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
167
167
( CastTy :: FnPtr , CastTy :: Int ( _) ) => {
168
168
self . register_violations ( & [ UnsafetyViolation {
169
169
source_info : self . source_info ,
170
- description : Symbol :: intern ( "cast of pointer to int" ) . as_interned_str ( ) ,
171
- details : Symbol :: intern ( "casting pointers to integers in constants" )
172
- . as_interned_str ( ) ,
170
+ description : InternedString :: intern ( "cast of pointer to int" ) ,
171
+ details : InternedString :: intern (
172
+ "casting pointers to integers in constants" ) ,
173
173
kind : UnsafetyViolationKind :: General ,
174
174
} ] , & [ ] ) ;
175
175
} ,
@@ -185,9 +185,8 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
185
185
if let ty:: RawPtr ( _) | ty:: FnPtr ( ..) = lhs. ty ( self . mir , self . tcx ) . sty {
186
186
self . register_violations ( & [ UnsafetyViolation {
187
187
source_info : self . source_info ,
188
- description : Symbol :: intern ( "pointer operation" ) . as_interned_str ( ) ,
189
- details : Symbol :: intern ( "operations on pointers in constants" )
190
- . as_interned_str ( ) ,
188
+ description : InternedString :: intern ( "pointer operation" ) ,
189
+ details : InternedString :: intern ( "operations on pointers in constants" ) ,
191
190
kind : UnsafetyViolationKind :: General ,
192
191
} ] , & [ ] ) ;
193
192
}
@@ -212,13 +211,11 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
212
211
self . source_scope_local_data [ source_info. scope ] . lint_root ;
213
212
self . register_violations ( & [ UnsafetyViolation {
214
213
source_info,
215
- description : Symbol :: intern ( "borrow of packed field" ) . as_interned_str ( ) ,
216
- details :
217
- Symbol :: intern ( "fields of packed structs might be misaligned: \
218
- dereferencing a misaligned pointer or even just \
219
- creating a misaligned reference is undefined \
220
- behavior")
221
- . as_interned_str ( ) ,
214
+ description : InternedString :: intern ( "borrow of packed field" ) ,
215
+ details : InternedString :: intern (
216
+ "fields of packed structs might be misaligned: dereferencing a \
217
+ misaligned pointer or even just creating a misaligned reference \
218
+ is undefined behavior") ,
222
219
kind : UnsafetyViolationKind :: BorrowPacked ( lint_root)
223
220
} ] , & [ ] ) ;
224
221
}
@@ -315,12 +312,10 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
315
312
self . source_scope_local_data [ source_info. scope ] . lint_root ;
316
313
self . register_violations ( & [ UnsafetyViolation {
317
314
source_info,
318
- description : Symbol :: intern ( "use of extern static" ) . as_interned_str ( ) ,
319
- details :
320
- Symbol :: intern ( "extern statics are not controlled by the Rust type \
321
- system: invalid data, aliasing violations or data \
322
- races will cause undefined behavior")
323
- . as_interned_str ( ) ,
315
+ description : InternedString :: intern ( "use of extern static" ) ,
316
+ details : InternedString :: intern (
317
+ "extern statics are not controlled by the Rust type system: invalid \
318
+ data, aliasing violations or data races will cause undefined behavior") ,
324
319
kind : UnsafetyViolationKind :: ExternStatic ( lint_root)
325
320
} ] , & [ ] ) ;
326
321
}
@@ -340,8 +335,8 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
340
335
let source_info = self . source_info ;
341
336
self . register_violations ( & [ UnsafetyViolation {
342
337
source_info,
343
- description : Symbol :: intern ( description) . as_interned_str ( ) ,
344
- details : Symbol :: intern ( details) . as_interned_str ( ) ,
338
+ description : InternedString :: intern ( description) ,
339
+ details : InternedString :: intern ( details) ,
345
340
kind,
346
341
} ] , & [ ] ) ;
347
342
}
@@ -441,8 +436,8 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
441
436
let source_info = self . source_info ;
442
437
self . register_violations ( & [ UnsafetyViolation {
443
438
source_info,
444
- description : Symbol :: intern ( description) . as_interned_str ( ) ,
445
- details : Symbol :: intern ( details) . as_interned_str ( ) ,
439
+ description : InternedString :: intern ( description) ,
440
+ details : InternedString :: intern ( details) ,
446
441
kind : UnsafetyViolationKind :: GeneralAndConstFn ,
447
442
} ] , & [ ] ) ;
448
443
}
0 commit comments