@@ -19,7 +19,7 @@ use syntax::{
19
19
mut_visit:: { self , MutVisitor } ,
20
20
parse:: ParseSess ,
21
21
ptr:: P ,
22
- symbol:: { Symbol , sym}
22
+ symbol:: { keywords , Symbol , sym}
23
23
} ;
24
24
use syntax_pos:: Span ;
25
25
@@ -110,13 +110,14 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
110
110
span,
111
111
kind : AllocatorKind :: Global ,
112
112
global : item. ident ,
113
- core : Ident :: from_str ( " core" ) ,
113
+ core : Ident :: with_empty_ctxt ( sym :: core) ,
114
114
cx : ExtCtxt :: new ( self . sess , ecfg, self . resolver ) ,
115
115
} ;
116
116
117
117
// We will generate a new submodule. To `use` the static from that module, we need to get
118
118
// the `super::...` path.
119
- let super_path = f. cx . path ( f. span , vec ! [ Ident :: from_str( "super" ) , f. global] ) ;
119
+ let super_path =
120
+ f. cx . path ( f. span , vec ! [ Ident :: with_empty_ctxt( keywords:: Super . name( ) ) , f. global] ) ;
120
121
121
122
// Generate the items in the submodule
122
123
let mut items = vec ! [
@@ -236,7 +237,7 @@ impl AllocFnFactory<'_> {
236
237
) -> P < Expr > {
237
238
match * ty {
238
239
AllocatorTy :: Layout => {
239
- let usize = self . cx . path_ident ( self . span , Ident :: from_str ( " usize" ) ) ;
240
+ let usize = self . cx . path_ident ( self . span , Ident :: with_empty_ctxt ( sym :: usize) ) ;
240
241
let ty_usize = self . cx . ty_path ( usize) ;
241
242
let size = ident ( ) ;
242
243
let align = ident ( ) ;
@@ -298,12 +299,12 @@ impl AllocFnFactory<'_> {
298
299
}
299
300
300
301
fn usize ( & self ) -> P < Ty > {
301
- let usize = self . cx . path_ident ( self . span , Ident :: from_str ( " usize" ) ) ;
302
+ let usize = self . cx . path_ident ( self . span , Ident :: with_empty_ctxt ( sym :: usize) ) ;
302
303
self . cx . ty_path ( usize)
303
304
}
304
305
305
306
fn ptr_u8 ( & self ) -> P < Ty > {
306
- let u8 = self . cx . path_ident ( self . span , Ident :: from_str ( "u8" ) ) ;
307
+ let u8 = self . cx . path_ident ( self . span , Ident :: with_empty_ctxt ( sym :: u8 ) ) ;
307
308
let ty_u8 = self . cx . ty_path ( u8) ;
308
309
self . cx . ty_ptr ( self . span , ty_u8, Mutability :: Mutable )
309
310
}
0 commit comments