@@ -13,8 +13,8 @@ use thin_vec::{ThinVec, thin_vec};
1313
1414use crate :: ast:: {
1515 AttrArgs , AttrId , AttrItem , AttrKind , AttrStyle , AttrVec , Attribute , DUMMY_NODE_ID , DelimArgs ,
16- EarlyParsedAttribute , Expr , ExprKind , LitKind , MetaItem , MetaItemInner , MetaItemKind ,
17- MetaItemLit , NormalAttr , Path , PathSegment , Safety ,
16+ Expr , ExprKind , LitKind , MetaItem , MetaItemInner , MetaItemKind , MetaItemLit , NormalAttr , Path ,
17+ PathSegment , Safety , SyntheticAttr ,
1818} ;
1919use crate :: token:: {
2020 self , CommentKind , Delimiter , DocFragmentKind , InvisibleOrigin , MetaVarKind , Token ,
@@ -61,16 +61,16 @@ impl Attribute {
6161 pub fn get_normal_item ( & self ) -> & AttrItem {
6262 match & self . kind {
6363 AttrKind :: Normal ( normal) => & normal. item ,
64- AttrKind :: Parsed ( ..) | AttrKind :: DocComment ( ..) => unreachable ! ( ) ,
64+ AttrKind :: Synthetic ( ..) | AttrKind :: DocComment ( ..) => unreachable ! ( ) ,
6565 }
6666 }
6767
68- pub fn convert_normal_to_parsed ( & mut self , early_parsed_attribute : EarlyParsedAttribute ) {
68+ pub fn convert_normal_to_synthetic ( & mut self , synthetic_attr : SyntheticAttr ) {
6969 match self . kind {
7070 AttrKind :: Normal ( ..) => {
71- self . kind = AttrKind :: Parsed ( Box :: new ( early_parsed_attribute ) ) ;
71+ self . kind = AttrKind :: Synthetic ( Box :: new ( synthetic_attr ) ) ;
7272 }
73- AttrKind :: Parsed ( ..) | AttrKind :: DocComment ( ..) => unreachable ! ( ) ,
73+ AttrKind :: Synthetic ( ..) | AttrKind :: DocComment ( ..) => unreachable ! ( ) ,
7474 }
7575 }
7676}
@@ -86,7 +86,7 @@ impl AttributeExt for Attribute {
8686 AttrArgs :: Eq { expr, .. } => Some ( expr. span ) ,
8787 _ => None ,
8888 } ,
89- AttrKind :: Parsed ( ..) | AttrKind :: DocComment ( ..) => None ,
89+ AttrKind :: Synthetic ( ..) | AttrKind :: DocComment ( ..) => None ,
9090 }
9191 }
9292
@@ -95,36 +95,36 @@ impl AttributeExt for Attribute {
9595 /// a doc comment) will return `false`.
9696 fn is_doc_comment ( & self ) -> Option < Span > {
9797 match self . kind {
98- AttrKind :: Normal ( ..) | AttrKind :: Parsed ( ..) => None ,
98+ AttrKind :: Normal ( ..) | AttrKind :: Synthetic ( ..) => None ,
9999 AttrKind :: DocComment ( ..) => Some ( self . span ) ,
100100 }
101101 }
102102
103103 /// For a single-segment attribute, returns its name; otherwise, returns `None`.
104104 fn name ( & self ) -> Option < Symbol > {
105- use EarlyParsedAttribute :: * ;
105+ use SyntheticAttr :: * ;
106106 match & self . kind {
107107 AttrKind :: Normal ( normal) => normal. item . name ( ) ,
108- AttrKind :: Parsed ( CfgTrace ( _) | CfgAttrTrace ) => None ,
108+ AttrKind :: Synthetic ( CfgTrace ( _) | CfgAttrTrace ) => None ,
109109 AttrKind :: DocComment ( ..) => None ,
110110 }
111111 }
112112
113113 fn symbol_path ( & self ) -> Option < SmallVec < [ Symbol ; 1 ] > > {
114- use EarlyParsedAttribute :: * ;
114+ use SyntheticAttr :: * ;
115115 match & self . kind {
116116 AttrKind :: Normal ( normal) => {
117117 Some ( normal. item . path . segments . iter ( ) . map ( |i| i. ident . name ) . collect ( ) )
118118 }
119- AttrKind :: Parsed ( CfgTrace ( _) | CfgAttrTrace ) => None ,
119+ AttrKind :: Synthetic ( CfgTrace ( _) | CfgAttrTrace ) => None ,
120120 AttrKind :: DocComment ( _, _) => None ,
121121 }
122122 }
123123
124124 fn path_span ( & self ) -> Option < Span > {
125125 match & self . kind {
126126 AttrKind :: Normal ( attr) => Some ( attr. item . path . span ) ,
127- AttrKind :: Parsed ( ..) => unreachable ! ( ) ,
127+ AttrKind :: Synthetic ( ..) => unreachable ! ( ) ,
128128 AttrKind :: DocComment ( _, _) => None ,
129129 }
130130 }
@@ -141,7 +141,7 @@ impl AttributeExt for Attribute {
141141 . zip ( name)
142142 . all ( |( s, n) | s. args . is_none ( ) && s. ident . name == * n)
143143 }
144- AttrKind :: Parsed ( ..) => false ,
144+ AttrKind :: Synthetic ( ..) => false ,
145145 AttrKind :: DocComment ( ..) => false ,
146146 }
147147 }
@@ -153,7 +153,7 @@ impl AttributeExt for Attribute {
153153 fn is_word ( & self ) -> bool {
154154 match & self . kind {
155155 AttrKind :: Normal ( normal) => matches ! ( normal. item. args, AttrArgs :: Empty ) ,
156- AttrKind :: Parsed ( ..) => unreachable ! ( ) ,
156+ AttrKind :: Synthetic ( ..) => unreachable ! ( ) ,
157157 AttrKind :: DocComment ( ..) => false ,
158158 }
159159 }
@@ -168,7 +168,7 @@ impl AttributeExt for Attribute {
168168 fn meta_item_list ( & self ) -> Option < ThinVec < MetaItemInner > > {
169169 match & self . kind {
170170 AttrKind :: Normal ( normal) => normal. item . meta_item_list ( ) ,
171- AttrKind :: Parsed ( ..) => None ,
171+ AttrKind :: Synthetic ( ..) => None ,
172172 AttrKind :: DocComment ( ..) => None ,
173173 }
174174 }
@@ -191,7 +191,7 @@ impl AttributeExt for Attribute {
191191 fn value_str ( & self ) -> Option < Symbol > {
192192 match & self . kind {
193193 AttrKind :: Normal ( normal) => normal. item . value_str ( ) ,
194- AttrKind :: Parsed ( ..) => unreachable ! ( ) ,
194+ AttrKind :: Synthetic ( ..) => unreachable ! ( ) ,
195195 AttrKind :: DocComment ( ..) => None ,
196196 }
197197 }
@@ -211,7 +211,7 @@ impl AttributeExt for Attribute {
211211 {
212212 Some ( ( value, DocFragmentKind :: Raw ( value_span) ) )
213213 }
214- AttrKind :: Normal ( ..) | AttrKind :: Parsed ( ..) => None ,
214+ AttrKind :: Normal ( ..) | AttrKind :: Synthetic ( ..) => None ,
215215 }
216216 }
217217
@@ -280,15 +280,15 @@ impl Attribute {
280280 pub fn meta ( & self ) -> Option < MetaItem > {
281281 match & self . kind {
282282 AttrKind :: Normal ( normal) => normal. item . meta ( self . span ) ,
283- AttrKind :: Parsed ( ..) => None ,
283+ AttrKind :: Synthetic ( ..) => None ,
284284 AttrKind :: DocComment ( ..) => None ,
285285 }
286286 }
287287
288288 pub fn meta_kind ( & self ) -> Option < MetaItemKind > {
289289 match & self . kind {
290290 AttrKind :: Normal ( normal) => normal. item . meta_kind ( ) ,
291- AttrKind :: Parsed ( ..) => unreachable ! ( ) ,
291+ AttrKind :: Synthetic ( ..) => unreachable ! ( ) ,
292292 AttrKind :: DocComment ( ..) => None ,
293293 }
294294 }
@@ -301,7 +301,7 @@ impl Attribute {
301301 . unwrap_or_else ( || panic ! ( "attribute is missing tokens: {self:?}" ) )
302302 . to_attr_token_stream ( )
303303 . to_token_trees ( ) ,
304- AttrKind :: Parsed ( ..) => vec ! [ ] ,
304+ AttrKind :: Synthetic ( ..) => vec ! [ ] ,
305305 AttrKind :: DocComment ( comment_kind, data) => vec ! [ TokenTree :: token_alone(
306306 token:: DocComment ( comment_kind, self . style, data) ,
307307 self . span,
0 commit comments