@@ -648,7 +648,7 @@ impl<'a> Parser<'a> {
648648 Ok ( ( Ident :: invalid ( ) , item_kind, Some ( attrs) ) )
649649 }
650650
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 > ) > {
652652 self . expect ( & token:: OpenDelim ( token:: Brace ) ) ?;
653653 let attrs = self . parse_inner_attributes ( ) ?;
654654
@@ -670,7 +670,7 @@ impl<'a> Parser<'a> {
670670 }
671671
672672 /// 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 > > {
674674 maybe_whole ! ( self , NtImplItem , |x| x) ;
675675 let attrs = self . parse_outer_attributes ( ) ?;
676676 let mut unclosed_delims = vec ! [ ] ;
@@ -685,7 +685,7 @@ impl<'a> Parser<'a> {
685685 if !item. attrs . iter ( ) . any ( |attr| attr. style == AttrStyle :: Inner ) {
686686 item. tokens = Some ( tokens) ;
687687 }
688- Ok ( item)
688+ Ok ( P ( item) )
689689 }
690690
691691 fn parse_impl_item_ (
@@ -858,7 +858,7 @@ impl<'a> Parser<'a> {
858858 }
859859
860860 /// 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 > > {
862862 maybe_whole ! ( self , NtTraitItem , |x| x) ;
863863 let attrs = self . parse_outer_attributes ( ) ?;
864864 let mut unclosed_delims = vec ! [ ] ;
@@ -872,7 +872,7 @@ impl<'a> Parser<'a> {
872872 if !item. attrs . iter ( ) . any ( |attr| attr. style == AttrStyle :: Inner ) {
873873 item. tokens = Some ( tokens) ;
874874 }
875- Ok ( item)
875+ Ok ( P ( item) )
876876 }
877877
878878 fn parse_trait_item_ (
@@ -1123,7 +1123,7 @@ impl<'a> Parser<'a> {
11231123 }
11241124
11251125 /// 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 > > {
11271127 maybe_whole ! ( self , NtForeignItem , |ni| ni) ;
11281128
11291129 let attrs = self . parse_outer_attributes ( ) ?;
@@ -1173,7 +1173,7 @@ impl<'a> Parser<'a> {
11731173
11741174 match self . parse_assoc_macro_invoc ( "extern" , Some ( & visibility) , & mut false ) ? {
11751175 Some ( mac) => {
1176- Ok (
1176+ Ok ( P (
11771177 ForeignItem {
11781178 ident : Ident :: invalid ( ) ,
11791179 span : lo. to ( self . prev_span ) ,
@@ -1183,7 +1183,7 @@ impl<'a> Parser<'a> {
11831183 kind : ForeignItemKind :: Macro ( mac) ,
11841184 tokens : None ,
11851185 }
1186- )
1186+ ) )
11871187 }
11881188 None => {
11891189 if !attrs. is_empty ( ) {
@@ -1198,41 +1198,41 @@ impl<'a> Parser<'a> {
11981198 /// Parses a static item from a foreign module.
11991199 /// Assumes that the `static` keyword is already parsed.
12001200 fn parse_item_foreign_static ( & mut self , vis : ast:: Visibility , lo : Span , attrs : Vec < Attribute > )
1201- -> PResult < ' a , ForeignItem > {
1201+ -> PResult < ' a , P < ForeignItem > > {
12021202 let mutbl = self . parse_mutability ( ) ;
12031203 let ident = self . parse_ident ( ) ?;
12041204 self . expect ( & token:: Colon ) ?;
12051205 let ty = self . parse_ty ( ) ?;
12061206 let hi = self . token . span ;
12071207 self . expect_semi ( ) ?;
1208- Ok ( ForeignItem {
1208+ Ok ( P ( ForeignItem {
12091209 ident,
12101210 attrs,
12111211 kind : ForeignItemKind :: Static ( ty, mutbl) ,
12121212 id : DUMMY_NODE_ID ,
12131213 span : lo. to ( hi) ,
12141214 vis,
12151215 tokens : None ,
1216- } )
1216+ } ) )
12171217 }
12181218
12191219 /// Parses a type from a foreign module.
12201220 fn parse_item_foreign_type ( & mut self , vis : ast:: Visibility , lo : Span , attrs : Vec < Attribute > )
1221- -> PResult < ' a , ForeignItem > {
1221+ -> PResult < ' a , P < ForeignItem > > {
12221222 self . expect_keyword ( kw:: Type ) ?;
12231223
12241224 let ident = self . parse_ident ( ) ?;
12251225 let hi = self . token . span ;
12261226 self . expect_semi ( ) ?;
1227- Ok ( ast:: ForeignItem {
1227+ Ok ( P ( ast:: ForeignItem {
12281228 ident,
12291229 attrs,
12301230 kind : ForeignItemKind :: Ty ,
12311231 id : DUMMY_NODE_ID ,
12321232 span : lo. to ( hi) ,
12331233 vis,
12341234 tokens : None ,
1235- } )
1235+ } ) )
12361236 }
12371237
12381238 fn is_static_global ( & mut self ) -> bool {
@@ -1813,7 +1813,7 @@ impl<'a> Parser<'a> {
18131813 lo : Span ,
18141814 attrs : Vec < Attribute > ,
18151815 extern_sp : Span ,
1816- ) -> PResult < ' a , ForeignItem > {
1816+ ) -> PResult < ' a , P < ForeignItem > > {
18171817 self . expect_keyword ( kw:: Fn ) ?;
18181818 let ( ident, decl, generics) = self . parse_fn_sig ( ParamCfg {
18191819 is_self_allowed : false ,
@@ -1822,15 +1822,15 @@ impl<'a> Parser<'a> {
18221822 } ) ?;
18231823 let span = lo. to ( self . token . span ) ;
18241824 self . parse_semi_or_incorrect_foreign_fn_body ( & ident, extern_sp) ?;
1825- Ok ( ast:: ForeignItem {
1825+ Ok ( P ( ast:: ForeignItem {
18261826 ident,
18271827 attrs,
18281828 kind : ForeignItemKind :: Fn ( decl, generics) ,
18291829 id : DUMMY_NODE_ID ,
18301830 span,
18311831 vis,
18321832 tokens : None ,
1833- } )
1833+ } ) )
18341834 }
18351835
18361836 /// Parses a method or a macro invocation in a trait impl.
0 commit comments