Skip to content

Commit 5c7b4e7

Browse files
committed
Box the UseTree in ItemKind::UseTree.
1 parent 07a2eb1 commit 5c7b4e7

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2817,7 +2817,7 @@ pub enum ItemKind {
28172817
/// A use declaration item (`use`).
28182818
///
28192819
/// E.g., `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;`.
2820-
Use(UseTree),
2820+
Use(P<UseTree>),
28212821
/// A static item (`static`).
28222822
///
28232823
/// E.g., `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`.
@@ -3043,8 +3043,8 @@ mod size_asserts {
30433043
static_assert_size!(GenericBound, 88);
30443044
static_assert_size!(Generics, 72);
30453045
static_assert_size!(Impl, 200);
3046-
static_assert_size!(Item, 176);
3047-
static_assert_size!(ItemKind, 88);
3046+
static_assert_size!(Item, 160);
3047+
static_assert_size!(ItemKind, 72);
30483048
static_assert_size!(Lit, 48);
30493049
static_assert_size!(Pat, 120);
30503050
static_assert_size!(Path, 40);

compiler/rustc_builtin_macros/src/assert/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ impl<'cx, 'a> Context<'cx, 'a> {
120120
Ident::new(sym::allow, self.span),
121121
vec![attr::mk_nested_word_item(Ident::new(sym::unused_imports, self.span))],
122122
))],
123-
ItemKind::Use(UseTree {
123+
ItemKind::Use(P(UseTree {
124124
prefix: self.cx.path(self.span, self.cx.std_path(&[sym::asserting])),
125125
kind: UseTreeKind::Nested(vec![
126126
nested_tree(self, sym::TryCaptureGeneric),
127127
nested_tree(self, sym::TryCapturePrintable),
128128
]),
129129
span: self.span,
130-
}),
130+
})),
131131
),
132132
)
133133
}

compiler/rustc_builtin_macros/src/standard_library_imports.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc_ast as ast;
2+
use rustc_ast::ptr::P;
23
use rustc_expand::base::{ExtCtxt, ResolverExpand};
34
use rustc_expand::expand::ExpansionConfig;
45
use rustc_session::Session;
@@ -79,11 +80,11 @@ pub fn inject(
7980
span,
8081
Ident::empty(),
8182
vec![cx.attribute(cx.meta_word(span, sym::prelude_import))],
82-
ast::ItemKind::Use(ast::UseTree {
83+
ast::ItemKind::Use(P(ast::UseTree {
8384
prefix: cx.path(span, import_path),
8485
kind: ast::UseTreeKind::Glob,
8586
span,
86-
}),
87+
})),
8788
);
8889

8990
krate.items.insert(0, use_item);

compiler/rustc_parse/src/parser/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl<'a> Parser<'a> {
328328
}
329329
return Err(e);
330330
}
331-
Ok((Ident::empty(), ItemKind::Use(tree)))
331+
Ok((Ident::empty(), ItemKind::Use(P(tree))))
332332
}
333333

334334
/// When parsing a statement, would the start of a path be an item?

0 commit comments

Comments
 (0)