base::{ExtCtxt, Resolver},
build::AstBuilder,
expand::ExpansionConfig,
- hygiene::{self, Mark, SyntaxContext},
+ hygiene::{Mark, SyntaxContext},
},
mut_visit::{self, MutVisitor},
parse::ParseSess,
ptr::P,
- symbol::{Symbol, sym}
+ symbol::{kw, sym, Symbol}
};
use syntax_pos::Span;
call_site: item.span, // use the call site of the static
def_site: None,
format: MacroAttribute(Symbol::intern(name)),
- allow_internal_unstable: Some(vec![
- Symbol::intern("rustc_attrs"),
- ].into()),
+ allow_internal_unstable: Some(vec![sym::rustc_attrs].into()),
allow_internal_unsafe: false,
local_inner_macros: false,
- edition: hygiene::default_edition(),
+ edition: self.sess.edition,
});
// Tie the span to the macro expansion info we just created
span,
kind: AllocatorKind::Global,
global: item.ident,
- core: Ident::from_str("core"),
+ core: Ident::with_empty_ctxt(sym::core),
cx: ExtCtxt::new(self.sess, ecfg, self.resolver),
};
// We will generate a new submodule. To `use` the static from that module, we need to get
// the `super::...` path.
- let super_path = f.cx.path(f.span, vec![Ident::from_str("super"), f.global]);
+ let super_path = f.cx.path(f.span, vec![Ident::with_empty_ctxt(kw::Super), f.global]);
// Generate the items in the submodule
let mut items = vec![
// Generate the submodule itself
let name = f.kind.fn_name("allocator_abi");
- let allocator_abi = Ident::with_empty_ctxt(Symbol::gensym(&name));
+ let allocator_abi = Ident::from_str(&name).gensym();
let module = f.cx.item_mod(span, span, allocator_abi, Vec::new(), items);
let module = f.cx.monotonic_expander().flat_map_item(module).pop().unwrap();
}
fn attrs(&self) -> Vec<Attribute> {
- let special = Symbol::intern("rustc_std_internal_symbol");
+ let special = sym::rustc_std_internal_symbol;
let special = self.cx.meta_word(self.span, special);
vec![self.cx.attribute(self.span, special)]
}
) -> P<Expr> {
match *ty {
AllocatorTy::Layout => {
- let usize = self.cx.path_ident(self.span, Ident::from_str("usize"));
+ let usize = self.cx.path_ident(self.span, Ident::with_empty_ctxt(sym::usize));
let ty_usize = self.cx.ty_path(usize);
let size = ident();
let align = ident();
}
fn usize(&self) -> P<Ty> {
- let usize = self.cx.path_ident(self.span, Ident::from_str("usize"));
+ let usize = self.cx.path_ident(self.span, Ident::with_empty_ctxt(sym::usize));
self.cx.ty_path(usize)
}
fn ptr_u8(&self) -> P<Ty> {
- let u8 = self.cx.path_ident(self.span, Ident::from_str("u8"));
+ let u8 = self.cx.path_ident(self.span, Ident::with_empty_ctxt(sym::u8));
let ty_u8 = self.cx.ty_path(u8);
self.cx.ty_ptr(self.span, ty_u8, Mutability::Mutable)
}