@@ -9,7 +9,7 @@ pub use StabilityLevel::*;
9
9
pub use crate :: ast:: Attribute ;
10
10
11
11
use crate :: ast;
12
- use crate :: ast:: { AttrId , AttrStyle , Name , Ident , Path , PathSegment } ;
12
+ use crate :: ast:: { AttrItem , AttrId , AttrStyle , Name , Ident , Path , PathSegment } ;
13
13
use crate :: ast:: { MetaItem , MetaItemKind , NestedMetaItem } ;
14
14
use crate :: ast:: { Lit , LitKind , Expr , Item , Local , Stmt , StmtKind , GenericParam } ;
15
15
use crate :: mut_visit:: visit_clobber;
@@ -332,10 +332,9 @@ impl Attribute {
332
332
DUMMY_SP ,
333
333
) ;
334
334
f ( & Attribute {
335
+ item : AttrItem { path : meta. path , tokens : meta. node . tokens ( meta. span ) } ,
335
336
id : self . id ,
336
337
style : self . style ,
337
- path : meta. path ,
338
- tokens : meta. node . tokens ( meta. span ) ,
339
338
is_sugared_doc : true ,
340
339
span : self . span ,
341
340
} )
@@ -384,10 +383,9 @@ crate fn mk_attr_id() -> AttrId {
384
383
/// Returns an inner attribute with the given value and span.
385
384
pub fn mk_attr_inner ( item : MetaItem ) -> Attribute {
386
385
Attribute {
386
+ item : AttrItem { path : item. path , tokens : item. node . tokens ( item. span ) } ,
387
387
id : mk_attr_id ( ) ,
388
388
style : ast:: AttrStyle :: Inner ,
389
- path : item. path ,
390
- tokens : item. node . tokens ( item. span ) ,
391
389
is_sugared_doc : false ,
392
390
span : item. span ,
393
391
}
@@ -396,10 +394,9 @@ pub fn mk_attr_inner(item: MetaItem) -> Attribute {
396
394
/// Returns an outer attribute with the given value and span.
397
395
pub fn mk_attr_outer ( item : MetaItem ) -> Attribute {
398
396
Attribute {
397
+ item : AttrItem { path : item. path , tokens : item. node . tokens ( item. span ) } ,
399
398
id : mk_attr_id ( ) ,
400
399
style : ast:: AttrStyle :: Outer ,
401
- path : item. path ,
402
- tokens : item. node . tokens ( item. span ) ,
403
400
is_sugared_doc : false ,
404
401
span : item. span ,
405
402
}
@@ -410,10 +407,12 @@ pub fn mk_sugared_doc_attr(text: Symbol, span: Span) -> Attribute {
410
407
let lit_kind = LitKind :: Str ( text, ast:: StrStyle :: Cooked ) ;
411
408
let lit = Lit :: from_lit_kind ( lit_kind, span) ;
412
409
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
+ } ,
413
414
id : mk_attr_id ( ) ,
414
415
style,
415
- path : Path :: from_ident ( Ident :: with_dummy_span ( sym:: doc) . with_span_pos ( span) ) ,
416
- tokens : MetaItemKind :: NameValue ( lit) . tokens ( span) ,
417
416
is_sugared_doc : true ,
418
417
span,
419
418
}
@@ -735,10 +734,9 @@ pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -
735
734
}
736
735
737
736
krate. attrs . push ( Attribute {
737
+ item : AttrItem { path, tokens } ,
738
738
id : mk_attr_id ( ) ,
739
739
style : AttrStyle :: Inner ,
740
- path,
741
- tokens,
742
740
is_sugared_doc : false ,
743
741
span : start_span. to ( end_span) ,
744
742
} ) ;
0 commit comments