Give more Idents spans

This commit is contained in:
Matthew Jasper
2019-09-14 21:16:51 +01:00
parent 57a45e9cbd
commit 5ae3830d58
17 changed files with 72 additions and 68 deletions

View File

@@ -43,7 +43,7 @@ pub fn expand(
let const_ty = ecx.ty(span, TyKind::Tup(Vec::new()));
let const_body = ecx.expr_block(ecx.block(span, stmts));
let const_item =
ecx.item_const(span, Ident::with_dummy_span(kw::Underscore), const_ty, const_body);
ecx.item_const(span, Ident::new(kw::Underscore, span), const_ty, const_body);
// Return the original item and the new methods.
vec![Annotatable::Item(item), Annotatable::Item(const_item)]
@@ -61,7 +61,7 @@ impl AllocFnFactory<'_, '_> {
let mut abi_args = Vec::new();
let mut i = 0;
let ref mut mk = || {
let name = Ident::from_str(&format!("arg{}", i));
let name = self.cx.ident_of(&format!("arg{}", i), self.span);
i += 1;
name
};
@@ -83,7 +83,7 @@ impl AllocFnFactory<'_, '_> {
);
let item = self.cx.item(
self.span,
Ident::from_str(&self.kind.fn_name(method.name)),
self.cx.ident_of(&self.kind.fn_name(method.name), self.span),
self.attrs(),
kind,
);
@@ -119,7 +119,7 @@ impl AllocFnFactory<'_, '_> {
) -> P<Expr> {
match *ty {
AllocatorTy::Layout => {
let usize = self.cx.path_ident(self.span, Ident::with_dummy_span(sym::usize));
let usize = self.cx.path_ident(self.span, Ident::new(sym::usize, self.span));
let ty_usize = self.cx.ty_path(usize);
let size = ident();
let align = ident();
@@ -177,12 +177,12 @@ impl AllocFnFactory<'_, '_> {
}
fn usize(&self) -> P<Ty> {
let usize = self.cx.path_ident(self.span, Ident::with_dummy_span(sym::usize));
let usize = self.cx.path_ident(self.span, Ident::new(sym::usize, self.span));
self.cx.ty_path(usize)
}
fn ptr_u8(&self) -> P<Ty> {
let u8 = self.cx.path_ident(self.span, Ident::with_dummy_span(sym::u8));
let u8 = self.cx.path_ident(self.span, Ident::new(sym::u8, self.span));
let ty_u8 = self.cx.ty_path(u8);
self.cx.ty_ptr(self.span, ty_u8, Mutability::Mutable)
}