Skip to content

Commit c12a8ca

Browse files
committed
Box MactoDef
1 parent bc438da commit c12a8ca

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,11 +2766,11 @@ pub enum ItemKind {
27662766
MacCall(Box<MacCall>),
27672767

27682768
/// A macro definition.
2769-
MacroDef(MacroDef),
2769+
MacroDef(Box<MacroDef>),
27702770
}
27712771

27722772
#[cfg(target_arch = "x86_64")]
2773-
rustc_data_structures::static_assert_size!(ItemKind, 24);
2773+
rustc_data_structures::static_assert_size!(ItemKind, 16);
27742774

27752775
impl ItemKind {
27762776
pub fn article(&self) -> &str {

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
230230
let mut vis = self.lower_visibility(&i.vis, None);
231231
let attrs = self.lower_attrs(&i.attrs);
232232

233-
if let ItemKind::MacroDef(MacroDef { ref body, macro_rules }) = i.kind {
233+
if let ItemKind::MacroDef(box MacroDef { ref body, macro_rules }) = i.kind {
234234
if !macro_rules || self.sess.contains_name(&i.attrs, sym::macro_export) {
235235
let hir_id = self.lower_node_id(i.id);
236236
let body = P(self.lower_mac_args(body));

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
396396
gate_feature_post!(&self, trait_alias, i.span, "trait aliases are experimental");
397397
}
398398

399-
ast::ItemKind::MacroDef(ast::MacroDef { macro_rules: false, .. }) => {
399+
ast::ItemKind::MacroDef(box ast::MacroDef { macro_rules: false, .. }) => {
400400
let msg = "`macro` is experimental";
401401
gate_feature_post!(&self, decl_macro, i.span, msg);
402402
}

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ impl CStore {
433433
id: ast::DUMMY_NODE_ID,
434434
span,
435435
attrs,
436-
kind: ast::ItemKind::MacroDef(data.get_macro(id.index, sess)),
436+
kind: ast::ItemKind::MacroDef(Box::new(data.get_macro(id.index, sess))),
437437
vis: ast::Visibility {
438438
span: span.shrink_to_lo(),
439439
kind: ast::VisibilityKind::Inherited,

compiler/rustc_parse/src/parser/item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ impl<'a> Parser<'a> {
14181418
};
14191419

14201420
self.sess.gated_spans.gate(sym::decl_macro, lo.to(self.prev_token.span));
1421-
Ok((ident, ItemKind::MacroDef(ast::MacroDef { body, macro_rules: false })))
1421+
Ok((ident, ItemKind::MacroDef(box ast::MacroDef { body, macro_rules: false })))
14221422
}
14231423

14241424
/// Is this unambiguously the start of a `macro_rules! foo` item defnition?
@@ -1438,7 +1438,7 @@ impl<'a> Parser<'a> {
14381438
self.eat_semi_for_macro_if_needed(&body);
14391439
self.complain_if_pub_macro(vis, true);
14401440

1441-
Ok((ident, ItemKind::MacroDef(ast::MacroDef { body, macro_rules: true })))
1441+
Ok((ident, ItemKind::MacroDef(box ast::MacroDef { body, macro_rules: true })))
14421442
}
14431443

14441444
/// Item macro invocations or `macro_rules!` definitions need inherited visibility.

0 commit comments

Comments
 (0)