@@ -648,7 +648,7 @@ impl<'a> Parser<'a> {
648
648
Ok ( ( Ident :: invalid ( ) , item_kind, Some ( attrs) ) )
649
649
}
650
650
651
- fn parse_impl_body ( & mut self ) -> PResult < ' a , ( Vec < ImplItem > , Vec < Attribute > ) > {
651
+ fn parse_impl_body ( & mut self ) -> PResult < ' a , ( Vec < P < ImplItem > > , Vec < Attribute > ) > {
652
652
self . expect ( & token:: OpenDelim ( token:: Brace ) ) ?;
653
653
let attrs = self . parse_inner_attributes ( ) ?;
654
654
@@ -670,7 +670,7 @@ impl<'a> Parser<'a> {
670
670
}
671
671
672
672
/// Parses an impl item.
673
- pub fn parse_impl_item ( & mut self , at_end : & mut bool ) -> PResult < ' a , ImplItem > {
673
+ pub fn parse_impl_item ( & mut self , at_end : & mut bool ) -> PResult < ' a , P < ImplItem > > {
674
674
maybe_whole ! ( self , NtImplItem , |x| x) ;
675
675
let attrs = self . parse_outer_attributes ( ) ?;
676
676
let mut unclosed_delims = vec ! [ ] ;
@@ -685,7 +685,7 @@ impl<'a> Parser<'a> {
685
685
if !item. attrs . iter ( ) . any ( |attr| attr. style == AttrStyle :: Inner ) {
686
686
item. tokens = Some ( tokens) ;
687
687
}
688
- Ok ( item)
688
+ Ok ( P ( item) )
689
689
}
690
690
691
691
fn parse_impl_item_ (
@@ -858,7 +858,7 @@ impl<'a> Parser<'a> {
858
858
}
859
859
860
860
/// Parses the items in a trait declaration.
861
- pub fn parse_trait_item ( & mut self , at_end : & mut bool ) -> PResult < ' a , TraitItem > {
861
+ pub fn parse_trait_item ( & mut self , at_end : & mut bool ) -> PResult < ' a , P < TraitItem > > {
862
862
maybe_whole ! ( self , NtTraitItem , |x| x) ;
863
863
let attrs = self . parse_outer_attributes ( ) ?;
864
864
let mut unclosed_delims = vec ! [ ] ;
@@ -872,7 +872,7 @@ impl<'a> Parser<'a> {
872
872
if !item. attrs . iter ( ) . any ( |attr| attr. style == AttrStyle :: Inner ) {
873
873
item. tokens = Some ( tokens) ;
874
874
}
875
- Ok ( item)
875
+ Ok ( P ( item) )
876
876
}
877
877
878
878
fn parse_trait_item_ (
@@ -1123,7 +1123,7 @@ impl<'a> Parser<'a> {
1123
1123
}
1124
1124
1125
1125
/// Parses a foreign item.
1126
- pub fn parse_foreign_item ( & mut self , extern_sp : Span ) -> PResult < ' a , ForeignItem > {
1126
+ pub fn parse_foreign_item ( & mut self , extern_sp : Span ) -> PResult < ' a , P < ForeignItem > > {
1127
1127
maybe_whole ! ( self , NtForeignItem , |ni| ni) ;
1128
1128
1129
1129
let attrs = self . parse_outer_attributes ( ) ?;
@@ -1173,7 +1173,7 @@ impl<'a> Parser<'a> {
1173
1173
1174
1174
match self . parse_assoc_macro_invoc ( "extern" , Some ( & visibility) , & mut false ) ? {
1175
1175
Some ( mac) => {
1176
- Ok (
1176
+ Ok ( P (
1177
1177
ForeignItem {
1178
1178
ident : Ident :: invalid ( ) ,
1179
1179
span : lo. to ( self . prev_span ) ,
@@ -1183,7 +1183,7 @@ impl<'a> Parser<'a> {
1183
1183
kind : ForeignItemKind :: Macro ( mac) ,
1184
1184
tokens : None ,
1185
1185
}
1186
- )
1186
+ ) )
1187
1187
}
1188
1188
None => {
1189
1189
if !attrs. is_empty ( ) {
@@ -1198,41 +1198,41 @@ impl<'a> Parser<'a> {
1198
1198
/// Parses a static item from a foreign module.
1199
1199
/// Assumes that the `static` keyword is already parsed.
1200
1200
fn parse_item_foreign_static ( & mut self , vis : ast:: Visibility , lo : Span , attrs : Vec < Attribute > )
1201
- -> PResult < ' a , ForeignItem > {
1201
+ -> PResult < ' a , P < ForeignItem > > {
1202
1202
let mutbl = self . parse_mutability ( ) ;
1203
1203
let ident = self . parse_ident ( ) ?;
1204
1204
self . expect ( & token:: Colon ) ?;
1205
1205
let ty = self . parse_ty ( ) ?;
1206
1206
let hi = self . token . span ;
1207
1207
self . expect_semi ( ) ?;
1208
- Ok ( ForeignItem {
1208
+ Ok ( P ( ForeignItem {
1209
1209
ident,
1210
1210
attrs,
1211
1211
kind : ForeignItemKind :: Static ( ty, mutbl) ,
1212
1212
id : DUMMY_NODE_ID ,
1213
1213
span : lo. to ( hi) ,
1214
1214
vis,
1215
1215
tokens : None ,
1216
- } )
1216
+ } ) )
1217
1217
}
1218
1218
1219
1219
/// Parses a type from a foreign module.
1220
1220
fn parse_item_foreign_type ( & mut self , vis : ast:: Visibility , lo : Span , attrs : Vec < Attribute > )
1221
- -> PResult < ' a , ForeignItem > {
1221
+ -> PResult < ' a , P < ForeignItem > > {
1222
1222
self . expect_keyword ( kw:: Type ) ?;
1223
1223
1224
1224
let ident = self . parse_ident ( ) ?;
1225
1225
let hi = self . token . span ;
1226
1226
self . expect_semi ( ) ?;
1227
- Ok ( ast:: ForeignItem {
1227
+ Ok ( P ( ast:: ForeignItem {
1228
1228
ident,
1229
1229
attrs,
1230
1230
kind : ForeignItemKind :: Ty ,
1231
1231
id : DUMMY_NODE_ID ,
1232
1232
span : lo. to ( hi) ,
1233
1233
vis,
1234
1234
tokens : None ,
1235
- } )
1235
+ } ) )
1236
1236
}
1237
1237
1238
1238
fn is_static_global ( & mut self ) -> bool {
@@ -1813,7 +1813,7 @@ impl<'a> Parser<'a> {
1813
1813
lo : Span ,
1814
1814
attrs : Vec < Attribute > ,
1815
1815
extern_sp : Span ,
1816
- ) -> PResult < ' a , ForeignItem > {
1816
+ ) -> PResult < ' a , P < ForeignItem > > {
1817
1817
self . expect_keyword ( kw:: Fn ) ?;
1818
1818
let ( ident, decl, generics) = self . parse_fn_sig ( ParamCfg {
1819
1819
is_self_allowed : false ,
@@ -1822,15 +1822,15 @@ impl<'a> Parser<'a> {
1822
1822
} ) ?;
1823
1823
let span = lo. to ( self . token . span ) ;
1824
1824
self . parse_semi_or_incorrect_foreign_fn_body ( & ident, extern_sp) ?;
1825
- Ok ( ast:: ForeignItem {
1825
+ Ok ( P ( ast:: ForeignItem {
1826
1826
ident,
1827
1827
attrs,
1828
1828
kind : ForeignItemKind :: Fn ( decl, generics) ,
1829
1829
id : DUMMY_NODE_ID ,
1830
1830
span,
1831
1831
vis,
1832
1832
tokens : None ,
1833
- } )
1833
+ } ) )
1834
1834
}
1835
1835
1836
1836
/// Parses a method or a macro invocation in a trait impl.
0 commit comments