mirror of https://github.com/rust-lang/rust.git
Remove `TraitDef::attributes`.
Because it's always empty.
This commit is contained in:
parent
5746c752f4
commit
2c24958cfd
|
@ -15,7 +15,6 @@ pub fn expand_deriving_copy(
|
|||
) {
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: path_std!(marker::Copy),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -71,7 +71,6 @@ pub fn expand_deriving_clone(
|
|||
let attrs = vec![cx.attribute(inline)];
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: path_std!(clone::Clone),
|
||||
additional_bounds: bounds,
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -23,7 +23,6 @@ pub fn expand_deriving_eq(
|
|||
let attrs = vec![cx.attribute(inline), cx.attribute(doc), cx.attribute(no_coverage)];
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: path_std!(cmp::Eq),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -18,7 +18,6 @@ pub fn expand_deriving_ord(
|
|||
let attrs = vec![cx.attribute(inline)];
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: path_std!(cmp::Ord),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -98,7 +98,6 @@ pub fn expand_deriving_partial_eq(
|
|||
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: path_std!(cmp::PartialEq),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -36,7 +36,6 @@ pub fn expand_deriving_partial_ord(
|
|||
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: vec![],
|
||||
path: path_std!(cmp::PartialOrd),
|
||||
additional_bounds: vec![],
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -19,7 +19,6 @@ pub fn expand_deriving_debug(
|
|||
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: path_std!(fmt::Debug),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -22,7 +22,6 @@ pub fn expand_deriving_rustc_decodable(
|
|||
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: Path::new_(vec![krate, sym::Decodable], vec![], PathKind::Global),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -25,7 +25,6 @@ pub fn expand_deriving_default(
|
|||
let attrs = vec![cx.attribute(inline)];
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: Path::new(vec![kw::Default, sym::Default]),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -106,7 +106,6 @@ pub fn expand_deriving_rustc_encodable(
|
|||
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: Path::new_(vec![krate, sym::Encodable], vec![], PathKind::Global),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
|
@ -184,8 +184,6 @@ pub struct TraitDef<'a> {
|
|||
/// The span for the current #[derive(Foo)] header.
|
||||
pub span: Span,
|
||||
|
||||
pub attributes: Vec<ast::Attribute>,
|
||||
|
||||
/// Path of the trait, including any type parameters
|
||||
pub path: Path,
|
||||
|
||||
|
@ -718,15 +716,13 @@ impl<'a> TraitDef<'a> {
|
|||
let self_type = cx.ty_path(path);
|
||||
|
||||
let attr = cx.attribute(cx.meta_word(self.span, sym::automatically_derived));
|
||||
let attrs = vec![attr];
|
||||
let opt_trait_ref = Some(trait_ref);
|
||||
|
||||
let mut a = vec![attr];
|
||||
a.extend(self.attributes.iter().cloned());
|
||||
|
||||
cx.item(
|
||||
self.span,
|
||||
Ident::empty(),
|
||||
a,
|
||||
attrs,
|
||||
ast::ItemKind::Impl(Box::new(ast::Impl {
|
||||
unsafety: ast::Unsafe::No,
|
||||
polarity: ast::ImplPolarity::Positive,
|
||||
|
|
|
@ -21,7 +21,6 @@ pub fn expand_deriving_hash(
|
|||
let arg = Path::new_local(typaram);
|
||||
let hash_trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path,
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
|
|
Loading…
Reference in New Issue