Rollup merge of #82321 - bugadani:ast3, r=varkor

AST: Remove some unnecessary boxes
This commit is contained in:
Dylan DPC 2021-02-25 14:34:03 +01:00 committed by GitHub
commit 20928e0cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 7 deletions

View File

@ -2695,7 +2695,7 @@ pub enum ItemKind {
/// A use declaration item (`use`). /// A use declaration item (`use`).
/// ///
/// E.g., `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;`. /// E.g., `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;`.
Use(P<UseTree>), Use(UseTree),
/// A static item (`static`). /// A static item (`static`).
/// ///
/// E.g., `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`. /// E.g., `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`.
@ -2719,7 +2719,7 @@ pub enum ItemKind {
/// E.g., `extern {}` or `extern "C" {}`. /// E.g., `extern {}` or `extern "C" {}`.
ForeignMod(ForeignMod), ForeignMod(ForeignMod),
/// Module-level inline assembly (from `global_asm!()`). /// Module-level inline assembly (from `global_asm!()`).
GlobalAsm(P<GlobalAsm>), GlobalAsm(GlobalAsm),
/// A type alias (`type`). /// A type alias (`type`).
/// ///
/// E.g., `type Foo = Bar<u8>;`. /// E.g., `type Foo = Bar<u8>;`.

View File

@ -28,7 +28,7 @@ pub fn expand_global_asm<'cx>(
ident: Ident::invalid(), ident: Ident::invalid(),
attrs: Vec::new(), attrs: Vec::new(),
id: ast::DUMMY_NODE_ID, id: ast::DUMMY_NODE_ID,
kind: ast::ItemKind::GlobalAsm(P(global_asm)), kind: ast::ItemKind::GlobalAsm(global_asm),
vis: ast::Visibility { vis: ast::Visibility {
span: sp.shrink_to_lo(), span: sp.shrink_to_lo(),
kind: ast::VisibilityKind::Inherited, kind: ast::VisibilityKind::Inherited,

View File

@ -1,5 +1,4 @@
use rustc_ast as ast; use rustc_ast as ast;
use rustc_ast::ptr::P;
use rustc_expand::base::{ExtCtxt, ResolverExpand}; use rustc_expand::base::{ExtCtxt, ResolverExpand};
use rustc_expand::expand::ExpansionConfig; use rustc_expand::expand::ExpansionConfig;
use rustc_session::Session; use rustc_session::Session;
@ -72,11 +71,11 @@ pub fn inject(
span, span,
Ident::invalid(), Ident::invalid(),
vec![cx.attribute(cx.meta_word(span, sym::prelude_import))], vec![cx.attribute(cx.meta_word(span, sym::prelude_import))],
ast::ItemKind::Use(P(ast::UseTree { ast::ItemKind::Use(ast::UseTree {
prefix: cx.path(span, import_path), prefix: cx.path(span, import_path),
kind: ast::UseTreeKind::Glob, kind: ast::UseTreeKind::Glob,
span, span,
})), }),
); );
krate.items.insert(0, use_item); krate.items.insert(0, use_item);

View File

@ -225,7 +225,7 @@ impl<'a> Parser<'a> {
return Err(e); return Err(e);
} }
(Ident::invalid(), ItemKind::Use(P(tree))) (Ident::invalid(), ItemKind::Use(tree))
} else if self.check_fn_front_matter() { } else if self.check_fn_front_matter() {
// FUNCTION ITEM // FUNCTION ITEM
let (ident, sig, generics, body) = self.parse_fn(attrs, req_name, lo)?; let (ident, sig, generics, body) = self.parse_fn(attrs, req_name, lo)?;