Remove Span argument from ExtCtxt::attribute

MetaItem.span was always equivalent
This commit is contained in:
Mark Rousskov
2019-07-30 14:12:52 -04:00
parent 0a42badd4c
commit b2c5065b04
14 changed files with 22 additions and 24 deletions

View File

@@ -259,7 +259,7 @@ pub trait AstBuilder {
generics: Generics) -> P<ast::Item>;
fn item_ty(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> P<ast::Item>;
fn attribute(&self, sp: Span, mi: ast::MetaItem) -> ast::Attribute;
fn attribute(&self, mi: ast::MetaItem) -> ast::Attribute;
fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem;
@@ -1134,8 +1134,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
self.item_ty_poly(span, name, ty, Generics::default())
}
fn attribute(&self, sp: Span, mi: ast::MetaItem) -> ast::Attribute {
attr::mk_attr_outer(sp, mi)
fn attribute(&self, mi: ast::MetaItem) -> ast::Attribute {
attr::mk_attr_outer(mi.span, mi)
}
fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem {

View File

@@ -239,11 +239,11 @@ crate fn add_derived_markers<T: HasAttrs>(
item.visit_attrs(|attrs| {
if names.contains(&sym::Eq) && names.contains(&sym::PartialEq) {
let meta = cx.meta_word(span, sym::structural_match);
attrs.push(cx.attribute(span, meta));
attrs.push(cx.attribute(meta));
}
if names.contains(&sym::Copy) {
let meta = cx.meta_word(span, sym::rustc_copy_clone_marker);
attrs.push(cx.attribute(span, meta));
attrs.push(cx.attribute(meta));
}
});
}