Remove box syntax from rustc_builtin_macros
This commit is contained in:
parent
1cd1cd034b
commit
489744f900
5 changed files with 24 additions and 12 deletions
|
@ -527,12 +527,12 @@ impl<'a> TraitDef<'a> {
|
||||||
tokens: None,
|
tokens: None,
|
||||||
},
|
},
|
||||||
attrs: Vec::new(),
|
attrs: Vec::new(),
|
||||||
kind: ast::AssocItemKind::TyAlias(box ast::TyAliasKind(
|
kind: ast::AssocItemKind::TyAlias(Box::new(ast::TyAliasKind(
|
||||||
ast::Defaultness::Final,
|
ast::Defaultness::Final,
|
||||||
Generics::default(),
|
Generics::default(),
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
Some(type_def.to_ty(cx, self.span, type_ident, generics)),
|
Some(type_def.to_ty(cx, self.span, type_ident, generics)),
|
||||||
)),
|
))),
|
||||||
tokens: None,
|
tokens: None,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -698,7 +698,7 @@ impl<'a> TraitDef<'a> {
|
||||||
self.span,
|
self.span,
|
||||||
Ident::invalid(),
|
Ident::invalid(),
|
||||||
a,
|
a,
|
||||||
ast::ItemKind::Impl(box ast::ImplKind {
|
ast::ItemKind::Impl(Box::new(ast::ImplKind {
|
||||||
unsafety,
|
unsafety,
|
||||||
polarity: ast::ImplPolarity::Positive,
|
polarity: ast::ImplPolarity::Positive,
|
||||||
defaultness: ast::Defaultness::Final,
|
defaultness: ast::Defaultness::Final,
|
||||||
|
@ -707,7 +707,7 @@ impl<'a> TraitDef<'a> {
|
||||||
of_trait: opt_trait_ref,
|
of_trait: opt_trait_ref,
|
||||||
self_ty: self_type,
|
self_ty: self_type,
|
||||||
items: methods.into_iter().chain(associated_types).collect(),
|
items: methods.into_iter().chain(associated_types).collect(),
|
||||||
}),
|
})),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,7 +940,12 @@ impl<'a> MethodDef<'a> {
|
||||||
tokens: None,
|
tokens: None,
|
||||||
},
|
},
|
||||||
ident: method_ident,
|
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,
|
tokens: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ fn inject_impl_of_structural_trait(
|
||||||
span,
|
span,
|
||||||
Ident::invalid(),
|
Ident::invalid(),
|
||||||
attrs,
|
attrs,
|
||||||
ItemKind::Impl(box ImplKind {
|
ItemKind::Impl(Box::new(ImplKind {
|
||||||
unsafety: ast::Unsafe::No,
|
unsafety: ast::Unsafe::No,
|
||||||
polarity: ast::ImplPolarity::Positive,
|
polarity: ast::ImplPolarity::Positive,
|
||||||
defaultness: ast::Defaultness::Final,
|
defaultness: ast::Defaultness::Final,
|
||||||
|
@ -188,7 +188,7 @@ fn inject_impl_of_structural_trait(
|
||||||
of_trait: Some(trait_ref),
|
of_trait: Some(trait_ref),
|
||||||
self_ty: self_type,
|
self_ty: self_type,
|
||||||
items: Vec::new(),
|
items: Vec::new(),
|
||||||
}),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
push(Annotatable::Item(newitem));
|
push(Annotatable::Item(newitem));
|
||||||
|
|
|
@ -85,8 +85,12 @@ impl AllocFnFactory<'_, '_> {
|
||||||
let header = FnHeader { unsafety: Unsafe::Yes(self.span), ..FnHeader::default() };
|
let header = FnHeader { unsafety: Unsafe::Yes(self.span), ..FnHeader::default() };
|
||||||
let sig = FnSig { decl, header, span: self.span };
|
let sig = FnSig { decl, header, span: self.span };
|
||||||
let block = Some(self.cx.block_expr(output_expr));
|
let block = Some(self.cx.block_expr(output_expr));
|
||||||
let kind =
|
let kind = ItemKind::Fn(Box::new(FnKind(
|
||||||
ItemKind::Fn(box FnKind(ast::Defaultness::Final, sig, Generics::default(), block));
|
ast::Defaultness::Final,
|
||||||
|
sig,
|
||||||
|
Generics::default(),
|
||||||
|
block,
|
||||||
|
)));
|
||||||
let item = self.cx.item(
|
let item = self.cx.item(
|
||||||
self.span,
|
self.span,
|
||||||
Ident::from_str_and_span(&self.kind.fn_name(method.name), self.span),
|
Ident::from_str_and_span(&self.kind.fn_name(method.name), self.span),
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
|
||||||
#![feature(bool_to_option)]
|
#![feature(bool_to_option)]
|
||||||
#![feature(crate_visibility_modifier)]
|
#![feature(crate_visibility_modifier)]
|
||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
|
|
|
@ -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 decl = ecx.fn_decl(vec![], ast::FnRetTy::Ty(main_ret_ty));
|
||||||
let sig = ast::FnSig { decl, header: ast::FnHeader::default(), span: sp };
|
let sig = ast::FnSig { decl, header: ast::FnHeader::default(), span: sp };
|
||||||
let def = ast::Defaultness::Final;
|
let def = ast::Defaultness::Final;
|
||||||
let main =
|
let main = ast::ItemKind::Fn(Box::new(ast::FnKind(
|
||||||
ast::ItemKind::Fn(box ast::FnKind(def, sig, ast::Generics::default(), Some(main_body)));
|
def,
|
||||||
|
sig,
|
||||||
|
ast::Generics::default(),
|
||||||
|
Some(main_body),
|
||||||
|
)));
|
||||||
|
|
||||||
// Honor the reexport_test_harness_main attribute
|
// Honor the reexport_test_harness_main attribute
|
||||||
let main_id = match cx.reexport_test_harness_main {
|
let main_id = match cx.reexport_test_harness_main {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue