@@ -19,7 +19,7 @@ use syntax::{
1919 mut_visit:: { self , MutVisitor } ,
2020 parse:: ParseSess ,
2121 ptr:: P ,
22- symbol:: { Symbol , sym}
22+ symbol:: { keywords , Symbol , sym}
2323} ;
2424use syntax_pos:: Span ;
2525
@@ -110,13 +110,14 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
110110 span,
111111 kind : AllocatorKind :: Global ,
112112 global : item. ident ,
113- core : Ident :: from_str ( " core" ) ,
113+ core : Ident :: with_empty_ctxt ( sym :: core) ,
114114 cx : ExtCtxt :: new ( self . sess , ecfg, self . resolver ) ,
115115 } ;
116116
117117 // We will generate a new submodule. To `use` the static from that module, we need to get
118118 // 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] ) ;
120121
121122 // Generate the items in the submodule
122123 let mut items = vec ! [
@@ -236,7 +237,7 @@ impl AllocFnFactory<'_> {
236237 ) -> P < Expr > {
237238 match * ty {
238239 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) ) ;
240241 let ty_usize = self . cx . ty_path ( usize) ;
241242 let size = ident ( ) ;
242243 let align = ident ( ) ;
@@ -298,12 +299,12 @@ impl AllocFnFactory<'_> {
298299 }
299300
300301 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) ) ;
302303 self . cx . ty_path ( usize)
303304 }
304305
305306 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 ) ) ;
307308 let ty_u8 = self . cx . ty_path ( u8) ;
308309 self . cx . ty_ptr ( self . span , ty_u8, Mutability :: Mutable )
309310 }
0 commit comments