@@ -9,7 +9,7 @@ pub use StabilityLevel::*;
99pub use crate :: ast:: Attribute ;
1010
1111use crate :: ast;
12- use crate :: ast:: { AttrId , AttrStyle , Name , Ident , Path , PathSegment } ;
12+ use crate :: ast:: { AttrItem , AttrId , AttrStyle , Name , Ident , Path , PathSegment } ;
1313use crate :: ast:: { MetaItem , MetaItemKind , NestedMetaItem } ;
1414use crate :: ast:: { Lit , LitKind , Expr , Item , Local , Stmt , StmtKind , GenericParam } ;
1515use crate :: mut_visit:: visit_clobber;
@@ -332,10 +332,9 @@ impl Attribute {
332332 DUMMY_SP ,
333333 ) ;
334334 f ( & Attribute {
335+ item : AttrItem { path : meta. path , tokens : meta. node . tokens ( meta. span ) } ,
335336 id : self . id ,
336337 style : self . style ,
337- path : meta. path ,
338- tokens : meta. node . tokens ( meta. span ) ,
339338 is_sugared_doc : true ,
340339 span : self . span ,
341340 } )
@@ -384,10 +383,9 @@ crate fn mk_attr_id() -> AttrId {
384383/// Returns an inner attribute with the given value and span.
385384pub fn mk_attr_inner ( item : MetaItem ) -> Attribute {
386385 Attribute {
386+ item : AttrItem { path : item. path , tokens : item. node . tokens ( item. span ) } ,
387387 id : mk_attr_id ( ) ,
388388 style : ast:: AttrStyle :: Inner ,
389- path : item. path ,
390- tokens : item. node . tokens ( item. span ) ,
391389 is_sugared_doc : false ,
392390 span : item. span ,
393391 }
@@ -396,10 +394,9 @@ pub fn mk_attr_inner(item: MetaItem) -> Attribute {
396394/// Returns an outer attribute with the given value and span.
397395pub fn mk_attr_outer ( item : MetaItem ) -> Attribute {
398396 Attribute {
397+ item : AttrItem { path : item. path , tokens : item. node . tokens ( item. span ) } ,
399398 id : mk_attr_id ( ) ,
400399 style : ast:: AttrStyle :: Outer ,
401- path : item. path ,
402- tokens : item. node . tokens ( item. span ) ,
403400 is_sugared_doc : false ,
404401 span : item. span ,
405402 }
@@ -410,10 +407,12 @@ pub fn mk_sugared_doc_attr(text: Symbol, span: Span) -> Attribute {
410407 let lit_kind = LitKind :: Str ( text, ast:: StrStyle :: Cooked ) ;
411408 let lit = Lit :: from_lit_kind ( lit_kind, span) ;
412409 Attribute {
410+ item : AttrItem {
411+ path : Path :: from_ident ( Ident :: with_dummy_span ( sym:: doc) . with_span_pos ( span) ) ,
412+ tokens : MetaItemKind :: NameValue ( lit) . tokens ( span) ,
413+ } ,
413414 id : mk_attr_id ( ) ,
414415 style,
415- path : Path :: from_ident ( Ident :: with_dummy_span ( sym:: doc) . with_span_pos ( span) ) ,
416- tokens : MetaItemKind :: NameValue ( lit) . tokens ( span) ,
417416 is_sugared_doc : true ,
418417 span,
419418 }
@@ -735,10 +734,9 @@ pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -
735734 }
736735
737736 krate. attrs . push ( Attribute {
737+ item : AttrItem { path, tokens } ,
738738 id : mk_attr_id ( ) ,
739739 style : AttrStyle :: Inner ,
740- path,
741- tokens,
742740 is_sugared_doc : false ,
743741 span : start_span. to ( end_span) ,
744742 } ) ;
0 commit comments