Box the biggest ast::ItemKind variants
This commit is contained in:
@@ -493,8 +493,8 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
|
||||
}
|
||||
fn visit_foreign_item(&mut self, foreign_item: &'ast ForeignItem) {
|
||||
match foreign_item.kind {
|
||||
ForeignItemKind::Fn(_, _, ref generics, _)
|
||||
| ForeignItemKind::TyAlias(_, ref generics, ..) => {
|
||||
ForeignItemKind::Fn(box FnKind(_, _, ref generics, _))
|
||||
| ForeignItemKind::TyAlias(box TyAliasKind(_, ref generics, ..)) => {
|
||||
self.with_generic_param_rib(generics, ItemRibKind(HasGenericParams::Yes), |this| {
|
||||
visit::walk_foreign_item(this, foreign_item);
|
||||
});
|
||||
@@ -938,7 +938,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||
debug!("(resolving item) resolving {} ({:?})", name, item.kind);
|
||||
|
||||
match item.kind {
|
||||
ItemKind::TyAlias(_, ref generics, _, _) | ItemKind::Fn(_, _, ref generics, _) => {
|
||||
ItemKind::TyAlias(box TyAliasKind(_, ref generics, _, _))
|
||||
| ItemKind::Fn(box FnKind(_, _, ref generics, _)) => {
|
||||
self.with_generic_param_rib(generics, ItemRibKind(HasGenericParams::Yes), |this| {
|
||||
visit::walk_item(this, item)
|
||||
});
|
||||
@@ -950,17 +951,17 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||
self.resolve_adt(item, generics);
|
||||
}
|
||||
|
||||
ItemKind::Impl {
|
||||
ItemKind::Impl(box ImplKind {
|
||||
ref generics,
|
||||
ref of_trait,
|
||||
ref self_ty,
|
||||
items: ref impl_items,
|
||||
..
|
||||
} => {
|
||||
}) => {
|
||||
self.resolve_implementation(generics, of_trait, &self_ty, item.id, impl_items);
|
||||
}
|
||||
|
||||
ItemKind::Trait(.., ref generics, ref bounds, ref trait_items) => {
|
||||
ItemKind::Trait(box TraitKind(.., ref generics, ref bounds, ref trait_items)) => {
|
||||
// Create a new rib for the trait-wide type parameters.
|
||||
self.with_generic_param_rib(generics, ItemRibKind(HasGenericParams::Yes), |this| {
|
||||
let local_def_id = this.r.local_def_id(item.id).to_def_id();
|
||||
@@ -995,10 +996,10 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||
);
|
||||
}
|
||||
}
|
||||
AssocItemKind::Fn(_, _, generics, _) => {
|
||||
AssocItemKind::Fn(box FnKind(_, _, generics, _)) => {
|
||||
walk_assoc_item(this, generics, item);
|
||||
}
|
||||
AssocItemKind::TyAlias(_, generics, _, _) => {
|
||||
AssocItemKind::TyAlias(box TyAliasKind(_, generics, _, _)) => {
|
||||
walk_assoc_item(this, generics, item);
|
||||
}
|
||||
AssocItemKind::MacCall(_) => {
|
||||
@@ -1306,7 +1307,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||
},
|
||||
);
|
||||
}
|
||||
AssocItemKind::Fn(_, _, generics, _) => {
|
||||
AssocItemKind::Fn(box FnKind(.., generics, _)) => {
|
||||
// We also need a new scope for the impl item type parameters.
|
||||
this.with_generic_param_rib(
|
||||
generics,
|
||||
@@ -1329,7 +1330,12 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||
},
|
||||
);
|
||||
}
|
||||
AssocItemKind::TyAlias(_, generics, _, _) => {
|
||||
AssocItemKind::TyAlias(box TyAliasKind(
|
||||
_,
|
||||
generics,
|
||||
_,
|
||||
_,
|
||||
)) => {
|
||||
// We also need a new scope for the impl item type parameters.
|
||||
this.with_generic_param_rib(
|
||||
generics,
|
||||
|
||||
Reference in New Issue
Block a user