Remove box syntax from rustc_builtin_macros

This commit is contained in:
est31 2021-08-05 03:53:21 +02:00
parent 1cd1cd034b
commit 489744f900
5 changed files with 24 additions and 12 deletions

View File

@ -527,12 +527,12 @@ impl<'a> TraitDef<'a> {
tokens: None,
},
attrs: Vec::new(),
kind: ast::AssocItemKind::TyAlias(box ast::TyAliasKind(
kind: ast::AssocItemKind::TyAlias(Box::new(ast::TyAliasKind(
ast::Defaultness::Final,
Generics::default(),
Vec::new(),
Some(type_def.to_ty(cx, self.span, type_ident, generics)),
)),
))),
tokens: None,
})
});
@ -698,7 +698,7 @@ impl<'a> TraitDef<'a> {
self.span,
Ident::invalid(),
a,
ast::ItemKind::Impl(box ast::ImplKind {
ast::ItemKind::Impl(Box::new(ast::ImplKind {
unsafety,
polarity: ast::ImplPolarity::Positive,
defaultness: ast::Defaultness::Final,
@ -707,7 +707,7 @@ impl<'a> TraitDef<'a> {
of_trait: opt_trait_ref,
self_ty: self_type,
items: methods.into_iter().chain(associated_types).collect(),
}),
})),
)
}
@ -940,7 +940,12 @@ impl<'a> MethodDef<'a> {
tokens: None,
},
ident: method_ident,
kind: ast::AssocItemKind::Fn(box ast::FnKind(def, sig, fn_generics, Some(body_block))),
kind: ast::AssocItemKind::Fn(Box::new(ast::FnKind(
def,
sig,
fn_generics,
Some(body_block),
))),
tokens: None,
})
}

View File

@ -179,7 +179,7 @@ fn inject_impl_of_structural_trait(
span,
Ident::invalid(),
attrs,
ItemKind::Impl(box ImplKind {
ItemKind::Impl(Box::new(ImplKind {
unsafety: ast::Unsafe::No,
polarity: ast::ImplPolarity::Positive,
defaultness: ast::Defaultness::Final,
@ -188,7 +188,7 @@ fn inject_impl_of_structural_trait(
of_trait: Some(trait_ref),
self_ty: self_type,
items: Vec::new(),
}),
})),
);
push(Annotatable::Item(newitem));

View File

@ -85,8 +85,12 @@ impl AllocFnFactory<'_, '_> {
let header = FnHeader { unsafety: Unsafe::Yes(self.span), ..FnHeader::default() };
let sig = FnSig { decl, header, span: self.span };
let block = Some(self.cx.block_expr(output_expr));
let kind =
ItemKind::Fn(box FnKind(ast::Defaultness::Final, sig, Generics::default(), block));
let kind = ItemKind::Fn(Box::new(FnKind(
ast::Defaultness::Final,
sig,
Generics::default(),
block,
)));
let item = self.cx.item(
self.span,
Ident::from_str_and_span(&self.kind.fn_name(method.name), self.span),

View File

@ -3,7 +3,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]

View File

@ -315,8 +315,12 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
let decl = ecx.fn_decl(vec![], ast::FnRetTy::Ty(main_ret_ty));
let sig = ast::FnSig { decl, header: ast::FnHeader::default(), span: sp };
let def = ast::Defaultness::Final;
let main =
ast::ItemKind::Fn(box ast::FnKind(def, sig, ast::Generics::default(), Some(main_body)));
let main = ast::ItemKind::Fn(Box::new(ast::FnKind(
def,
sig,
ast::Generics::default(),
Some(main_body),
)));
// Honor the reexport_test_harness_main attribute
let main_id = match cx.reexport_test_harness_main {