Skip to content

Commit 2c24958

Browse files
committed
Remove TraitDef::attributes.
Because it's always empty.
1 parent 5746c75 commit 2c24958

File tree

12 files changed

+2
-17
lines changed

12 files changed

+2
-17
lines changed

compiler/rustc_builtin_macros/src/deriving/bounds.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub fn expand_deriving_copy(
1515
) {
1616
let trait_def = TraitDef {
1717
span,
18-
attributes: Vec::new(),
1918
path: path_std!(marker::Copy),
2019
additional_bounds: Vec::new(),
2120
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/clone.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ pub fn expand_deriving_clone(
7171
let attrs = vec![cx.attribute(inline)];
7272
let trait_def = TraitDef {
7373
span,
74-
attributes: Vec::new(),
7574
path: path_std!(clone::Clone),
7675
additional_bounds: bounds,
7776
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub fn expand_deriving_eq(
2323
let attrs = vec![cx.attribute(inline), cx.attribute(doc), cx.attribute(no_coverage)];
2424
let trait_def = TraitDef {
2525
span,
26-
attributes: Vec::new(),
2726
path: path_std!(cmp::Eq),
2827
additional_bounds: Vec::new(),
2928
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub fn expand_deriving_ord(
1818
let attrs = vec![cx.attribute(inline)];
1919
let trait_def = TraitDef {
2020
span,
21-
attributes: Vec::new(),
2221
path: path_std!(cmp::Ord),
2322
additional_bounds: Vec::new(),
2423
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ pub fn expand_deriving_partial_eq(
9898

9999
let trait_def = TraitDef {
100100
span,
101-
attributes: Vec::new(),
102101
path: path_std!(cmp::PartialEq),
103102
additional_bounds: Vec::new(),
104103
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ pub fn expand_deriving_partial_ord(
3636

3737
let trait_def = TraitDef {
3838
span,
39-
attributes: vec![],
4039
path: path_std!(cmp::PartialOrd),
4140
additional_bounds: vec![],
4241
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/debug.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub fn expand_deriving_debug(
1919

2020
let trait_def = TraitDef {
2121
span,
22-
attributes: Vec::new(),
2322
path: path_std!(fmt::Debug),
2423
additional_bounds: Vec::new(),
2524
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/decodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub fn expand_deriving_rustc_decodable(
2222

2323
let trait_def = TraitDef {
2424
span,
25-
attributes: Vec::new(),
2625
path: Path::new_(vec![krate, sym::Decodable], vec![], PathKind::Global),
2726
additional_bounds: Vec::new(),
2827
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/default.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub fn expand_deriving_default(
2525
let attrs = vec![cx.attribute(inline)];
2626
let trait_def = TraitDef {
2727
span,
28-
attributes: Vec::new(),
2928
path: Path::new(vec![kw::Default, sym::Default]),
3029
additional_bounds: Vec::new(),
3130
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/encodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ pub fn expand_deriving_rustc_encodable(
106106

107107
let trait_def = TraitDef {
108108
span,
109-
attributes: Vec::new(),
110109
path: Path::new_(vec![krate, sym::Encodable], vec![], PathKind::Global),
111110
additional_bounds: Vec::new(),
112111
generics: Bounds::empty(),

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ pub struct TraitDef<'a> {
184184
/// The span for the current #[derive(Foo)] header.
185185
pub span: Span,
186186

187-
pub attributes: Vec<ast::Attribute>,
188-
189187
/// Path of the trait, including any type parameters
190188
pub path: Path,
191189

@@ -718,15 +716,13 @@ impl<'a> TraitDef<'a> {
718716
let self_type = cx.ty_path(path);
719717

720718
let attr = cx.attribute(cx.meta_word(self.span, sym::automatically_derived));
719+
let attrs = vec![attr];
721720
let opt_trait_ref = Some(trait_ref);
722721

723-
let mut a = vec![attr];
724-
a.extend(self.attributes.iter().cloned());
725-
726722
cx.item(
727723
self.span,
728724
Ident::empty(),
729-
a,
725+
attrs,
730726
ast::ItemKind::Impl(Box::new(ast::Impl {
731727
unsafety: ast::Unsafe::No,
732728
polarity: ast::ImplPolarity::Positive,

compiler/rustc_builtin_macros/src/deriving/hash.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub fn expand_deriving_hash(
2121
let arg = Path::new_local(typaram);
2222
let hash_trait_def = TraitDef {
2323
span,
24-
attributes: Vec::new(),
2524
path,
2625
additional_bounds: Vec::new(),
2726
generics: Bounds::empty(),

0 commit comments

Comments
 (0)