@@ -15,10 +15,10 @@ pub use self::ReprAttr::*;
1515pub use self :: IntType :: * ;
1616
1717use ast;
18- use ast:: { AttrId , Attribute , Attribute_ } ;
18+ use ast:: { AttrId , Attribute } ;
1919use ast:: { MetaItem , MetaItemKind , NestedMetaItem , NestedMetaItemKind } ;
2020use ast:: { Lit , Expr , Item , Local , Stmt , StmtKind } ;
21- use codemap:: { respan, spanned, dummy_spanned} ;
21+ use codemap:: { respan, spanned, dummy_spanned, mk_sp } ;
2222use syntax_pos:: { Span , BytePos , DUMMY_SP } ;
2323use errors:: Handler ;
2424use feature_gate:: { Features , GatedCfg } ;
@@ -61,7 +61,7 @@ fn handle_errors(diag: &Handler, span: Span, error: AttrError) {
6161
6262pub fn mark_used ( attr : & Attribute ) {
6363 debug ! ( "Marking {:?} as used." , attr) ;
64- let AttrId ( id) = attr. node . id ;
64+ let AttrId ( id) = attr. id ;
6565 USED_ATTRS . with ( |slot| {
6666 let idx = ( id / 64 ) as usize ;
6767 let shift = id % 64 ;
@@ -73,7 +73,7 @@ pub fn mark_used(attr: &Attribute) {
7373}
7474
7575pub fn is_used ( attr : & Attribute ) -> bool {
76- let AttrId ( id) = attr. node . id ;
76+ let AttrId ( id) = attr. id ;
7777 USED_ATTRS . with ( |slot| {
7878 let idx = ( id / 64 ) as usize ;
7979 let shift = id % 64 ;
@@ -84,7 +84,7 @@ pub fn is_used(attr: &Attribute) -> bool {
8484
8585pub fn mark_known ( attr : & Attribute ) {
8686 debug ! ( "Marking {:?} as known." , attr) ;
87- let AttrId ( id) = attr. node . id ;
87+ let AttrId ( id) = attr. id ;
8888 KNOWN_ATTRS . with ( |slot| {
8989 let idx = ( id / 64 ) as usize ;
9090 let shift = id % 64 ;
@@ -96,7 +96,7 @@ pub fn mark_known(attr: &Attribute) {
9696}
9797
9898pub fn is_known ( attr : & Attribute ) -> bool {
99- let AttrId ( id) = attr. node . id ;
99+ let AttrId ( id) = attr. id ;
100100 KNOWN_ATTRS . with ( |slot| {
101101 let idx = ( id / 64 ) as usize ;
102102 let shift = id % 64 ;
@@ -270,7 +270,7 @@ impl MetaItem {
270270impl Attribute {
271271 /// Extract the MetaItem from inside this Attribute.
272272 pub fn meta ( & self ) -> & MetaItem {
273- & self . node . value
273+ & self . value
274274 }
275275
276276 /// Convert self to a normal #[doc="foo"] comment, if it is a
@@ -279,16 +279,16 @@ impl Attribute {
279279 pub fn with_desugared_doc < T , F > ( & self , f : F ) -> T where
280280 F : FnOnce ( & Attribute ) -> T ,
281281 {
282- if self . node . is_sugared_doc {
282+ if self . is_sugared_doc {
283283 let comment = self . value_str ( ) . unwrap ( ) ;
284284 let meta = mk_name_value_item_str (
285285 InternedString :: new ( "doc" ) ,
286286 token:: intern_and_get_ident ( & strip_doc_comment_decoration (
287287 & comment) ) ) ;
288- if self . node . style == ast:: AttrStyle :: Outer {
289- f ( & mk_attr_outer ( self . node . id , meta) )
288+ if self . style == ast:: AttrStyle :: Outer {
289+ f ( & mk_attr_outer ( self . id , meta) )
290290 } else {
291- f ( & mk_attr_inner ( self . node . id , meta) )
291+ f ( & mk_attr_inner ( self . id , meta) )
292292 }
293293 } else {
294294 f ( self )
@@ -355,13 +355,13 @@ pub fn mk_attr_inner(id: AttrId, item: P<MetaItem>) -> Attribute {
355355
356356/// Returns an innter attribute with the given value and span.
357357pub fn mk_spanned_attr_inner ( sp : Span , id : AttrId , item : P < MetaItem > ) -> Attribute {
358- respan ( sp ,
359- Attribute_ {
360- id : id ,
361- style : ast :: AttrStyle :: Inner ,
362- value : item ,
363- is_sugared_doc : false ,
364- } )
358+ Attribute {
359+ id : id ,
360+ style : ast :: AttrStyle :: Inner ,
361+ value : item ,
362+ is_sugared_doc : false ,
363+ span : sp ,
364+ }
365365}
366366
367367
@@ -372,36 +372,36 @@ pub fn mk_attr_outer(id: AttrId, item: P<MetaItem>) -> Attribute {
372372
373373/// Returns an outer attribute with the given value and span.
374374pub fn mk_spanned_attr_outer ( sp : Span , id : AttrId , item : P < MetaItem > ) -> Attribute {
375- respan ( sp ,
376- Attribute_ {
377- id : id ,
378- style : ast :: AttrStyle :: Outer ,
379- value : item ,
380- is_sugared_doc : false ,
381- } )
375+ Attribute {
376+ id : id ,
377+ style : ast :: AttrStyle :: Outer ,
378+ value : item ,
379+ is_sugared_doc : false ,
380+ span : sp ,
381+ }
382382}
383383
384384pub fn mk_doc_attr_outer ( id : AttrId , item : P < MetaItem > , is_sugared_doc : bool ) -> Attribute {
385- dummy_spanned ( Attribute_ {
385+ Attribute {
386386 id : id,
387387 style : ast:: AttrStyle :: Outer ,
388388 value : item,
389389 is_sugared_doc : is_sugared_doc,
390- } )
390+ span : DUMMY_SP ,
391+ }
391392}
392393
393- pub fn mk_sugared_doc_attr ( id : AttrId , text : InternedString , lo : BytePos ,
394- hi : BytePos )
394+ pub fn mk_sugared_doc_attr ( id : AttrId , text : InternedString , lo : BytePos , hi : BytePos )
395395 -> Attribute {
396396 let style = doc_comment_style ( & text) ;
397397 let lit = spanned ( lo, hi, ast:: LitKind :: Str ( text, ast:: StrStyle :: Cooked ) ) ;
398- let attr = Attribute_ {
398+ Attribute {
399399 id : id,
400400 style : style,
401401 value : P ( spanned ( lo, hi, MetaItemKind :: NameValue ( InternedString :: new ( "doc" ) , lit) ) ) ,
402- is_sugared_doc : true
403- } ;
404- spanned ( lo , hi , attr )
402+ is_sugared_doc : true ,
403+ span : mk_sp ( lo , hi ) ,
404+ }
405405}
406406
407407/* Searching */
@@ -489,7 +489,7 @@ pub enum InlineAttr {
489489/// Determine what `#[inline]` attribute is present in `attrs`, if any.
490490pub fn find_inline_attr ( diagnostic : Option < & Handler > , attrs : & [ Attribute ] ) -> InlineAttr {
491491 attrs. iter ( ) . fold ( InlineAttr :: None , |ia, attr| {
492- match attr. node . value . node {
492+ match attr. value . node {
493493 MetaItemKind :: Word ( ref n) if n == "inline" => {
494494 mark_used ( attr) ;
495495 InlineAttr :: Hint
@@ -896,7 +896,7 @@ pub fn require_unique_names(diagnostic: &Handler, metas: &[P<MetaItem>]) {
896896/// structure layout, and `packed` to remove padding.
897897pub fn find_repr_attrs ( diagnostic : & Handler , attr : & Attribute ) -> Vec < ReprAttr > {
898898 let mut acc = Vec :: new ( ) ;
899- match attr. node . value . node {
899+ match attr. value . node {
900900 ast:: MetaItemKind :: List ( ref s, ref items) if s == "repr" => {
901901 mark_used ( attr) ;
902902 for item in items {
0 commit comments