Skip to content

Commit 40f7633

Browse files
committed
Shrink ast::Impl.
1 parent 2ec25a1 commit 40f7633

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,7 +2801,7 @@ pub struct Impl {
28012801
/// The trait being implemented, if any.
28022802
pub of_trait: Option<TraitRef>,
28032803
pub self_ty: P<Ty>,
2804-
pub items: Vec<P<AssocItem>>,
2804+
pub items: Box<[P<AssocItem>]>,
28052805
}
28062806

28072807
#[derive(Clone, Encodable, Decodable, Debug)]
@@ -3048,7 +3048,7 @@ mod size_asserts {
30483048
static_assert_size!(GenericArg, 24);
30493049
static_assert_size!(GenericBound, 88);
30503050
static_assert_size!(Generics, 72);
3051-
static_assert_size!(Impl, 200);
3051+
static_assert_size!(Impl, 192);
30523052
static_assert_size!(Item, 184);
30533053
static_assert_size!(ItemKind, 112);
30543054
static_assert_size!(Lit, 48);

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
340340
visitor.visit_generics(generics);
341341
walk_list!(visitor, visit_trait_ref, of_trait);
342342
visitor.visit_ty(self_ty);
343-
walk_list!(visitor, visit_assoc_item, items, AssocCtxt::Impl);
343+
walk_list!(visitor, visit_assoc_item, items.iter(), AssocCtxt::Impl);
344344
}
345345
ItemKind::Struct(ref struct_definition, ref generics)
346346
| ItemKind::Union(ref struct_definition, ref generics) => {

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
10521052
this.visit_trait_ref(t);
10531053
this.visit_ty(self_ty);
10541054

1055-
walk_list!(this, visit_assoc_item, items, AssocCtxt::Impl);
1055+
walk_list!(this, visit_assoc_item, items.iter(), AssocCtxt::Impl);
10561056
});
10571057
return; // Avoid visiting again.
10581058
}

compiler/rustc_ast_pretty/src/pprust/state/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl<'a> State<'a> {
294294
self.space();
295295
self.bopen();
296296
self.print_inner_attributes(&item.attrs);
297-
for impl_item in items {
297+
for impl_item in items.iter() {
298298
self.print_assoc_item(impl_item);
299299
}
300300
let empty = item.attrs.is_empty() && items.is_empty();

compiler/rustc_builtin_macros/src/deriving/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn inject_impl_of_structural_trait(
187187
generics,
188188
of_trait: Some(trait_ref),
189189
self_ty: self_type,
190-
items: Vec::new(),
190+
items: Box::new([]),
191191
})),
192192
);
193193

compiler/rustc_parse/src/parser/item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ impl<'a> Parser<'a> {
637637
generics,
638638
of_trait: Some(trait_ref),
639639
self_ty: ty_second,
640-
items: impl_items,
640+
items: impl_items.into_boxed_slice(),
641641
}))
642642
}
643643
None => {
@@ -650,7 +650,7 @@ impl<'a> Parser<'a> {
650650
generics,
651651
of_trait: None,
652652
self_ty: ty_first,
653-
items: impl_items,
653+
items: impl_items.into_boxed_slice(),
654654
}))
655655
}
656656
};

0 commit comments

Comments
 (0)