Skip to content

Commit db3c461

Browse files
committed
Remove box from ConstItem and StaticItem ty
1 parent 6b4897c commit db3c461

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

compiler/rustc_ast/src/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3851,7 +3851,7 @@ pub struct DelegationMac {
38513851
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
38523852
pub struct StaticItem {
38533853
pub ident: Ident,
3854-
pub ty: Box<Ty>,
3854+
pub ty: Ty,
38553855
pub safety: Safety,
38563856
pub mutability: Mutability,
38573857
pub expr: Option<Box<Expr>>,
@@ -3863,7 +3863,7 @@ pub struct ConstItem {
38633863
pub defaultness: Defaultness,
38643864
pub ident: Ident,
38653865
pub generics: Generics,
3866-
pub ty: Box<Ty>,
3866+
pub ty: Ty,
38673867
pub rhs_kind: ConstItemRhsKind,
38683868
pub define_opaque: Option<ThinVec<(NodeId, Path)>>,
38693869
}

compiler/rustc_builtin_macros/src/proc_macro_harness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> Box<ast::Item> {
365365
let mut decls_static = cx.item_static(
366366
span,
367367
Ident::new(sym::_DECLS, span),
368-
Box::new(cx.ty_ref(
368+
cx.ty_ref(
369369
span,
370370
Box::new(cx.ty(
371371
span,
@@ -375,7 +375,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> Box<ast::Item> {
375375
)),
376376
None,
377377
ast::Mutability::Not,
378-
)),
378+
),
379379
ast::Mutability::Not,
380380
cx.expr_array_ref(span, decls),
381381
);

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ pub(crate) fn expand_test_or_bench(
286286
defaultness: ast::Defaultness::Implicit,
287287
ident: Ident::new(fn_.ident.name, sp),
288288
generics: ast::Generics::default(),
289-
ty: Box::new(cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn")))),
289+
ty: cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))),
290290
define_opaque: None,
291291
// test::TestDescAndFn {
292292
rhs_kind: ast::ConstItemRhsKind::new_body(

compiler/rustc_expand/src/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ impl<'a> ExtCtxt<'a> {
701701
&self,
702702
span: Span,
703703
ident: Ident,
704-
ty: Box<ast::Ty>,
704+
ty: ast::Ty,
705705
mutability: ast::Mutability,
706706
expr: Box<ast::Expr>,
707707
) -> Box<ast::Item> {
@@ -739,7 +739,7 @@ impl<'a> ExtCtxt<'a> {
739739
ident,
740740
// FIXME(generic_const_items): Pass the generics as a parameter.
741741
generics: ast::Generics::default(),
742-
ty: Box::new(ty),
742+
ty,
743743
rhs_kind,
744744
define_opaque: None,
745745
}

compiler/rustc_parse/src/parser/item.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ impl<'a> Parser<'a> {
15301530
// Parse the type of a static item. That is, the `":" $ty` fragment.
15311531
// FIXME: This could maybe benefit from `.may_recover()`?
15321532
let ty = match (self.eat(exp!(Colon)), self.check(exp!(Eq)) | self.check(exp!(Semi))) {
1533-
(true, false) => Box::new(self.parse_ty()?),
1533+
(true, false) => self.parse_ty()?,
15341534
// If there wasn't a `:` or the colon was followed by a `=` or `;`, recover a missing
15351535
// type.
15361536
(colon, _) => self.recover_missing_global_item_type(colon, Some(mutability)),
@@ -1555,7 +1555,7 @@ impl<'a> Parser<'a> {
15551555
fn parse_const_item(
15561556
&mut self,
15571557
const_arg: bool,
1558-
) -> PResult<'a, (Ident, Generics, Box<Ty>, ConstItemRhsKind)> {
1558+
) -> PResult<'a, (Ident, Generics, Ty, ConstItemRhsKind)> {
15591559
let ident = self.parse_ident_or_underscore()?;
15601560

15611561
let mut generics = self.parse_generics()?;
@@ -1572,7 +1572,7 @@ impl<'a> Parser<'a> {
15721572
self.eat(exp!(Colon)),
15731573
self.check(exp!(Eq)) | self.check(exp!(Semi)) | self.check_keyword(exp!(Where)),
15741574
) {
1575-
(true, false) => Box::new(self.parse_ty()?),
1575+
(true, false) => self.parse_ty()?,
15761576
// If there wasn't a `:` or the colon was followed by a `=`, `;` or `where`, recover a missing type.
15771577
(colon, _) => self.recover_missing_global_item_type(colon, None),
15781578
};
@@ -1657,7 +1657,7 @@ impl<'a> Parser<'a> {
16571657
&mut self,
16581658
colon_present: bool,
16591659
m: Option<Mutability>,
1660-
) -> Box<Ty> {
1660+
) -> Ty {
16611661
// Construct the error and stash it away with the hope
16621662
// that typeck will later enrich the error with a type.
16631663
let kind = match m {
@@ -1677,7 +1677,7 @@ impl<'a> Parser<'a> {
16771677

16781678
// The user intended that the type be inferred,
16791679
// so treat this as if the user wrote e.g. `const A: _ = expr;`.
1680-
Box::new(Ty { kind: TyKind::Infer, span, id: ast::DUMMY_NODE_ID, tokens: None })
1680+
Ty { kind: TyKind::Infer, span, id: ast::DUMMY_NODE_ID, tokens: None }
16811681
}
16821682

16831683
/// Parses an enum declaration.

0 commit comments

Comments
 (0)