@@ -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