@@ -3,7 +3,7 @@ use rustc_ast::token::CommentKind;
33use rustc_ast:: { self as ast, AttrStyle } ;
44use rustc_macros:: { Decodable , Encodable , HashStable_Generic , PrintAttribute } ;
55use rustc_span:: hygiene:: Transparency ;
6- use rustc_span:: { Span , Symbol } ;
6+ use rustc_span:: { Ident , Span , Symbol } ;
77use thin_vec:: ThinVec ;
88
99use crate :: { DefaultBodyStability , PartialConstStability , PrintAttribute , RustcVersion , Stability } ;
@@ -69,6 +69,7 @@ pub enum ReprAttr {
6969 ReprAlign ( Align ) ,
7070}
7171pub use ReprAttr :: * ;
72+ use rustc_span:: def_id:: DefId ;
7273
7374pub enum TransparencyError {
7475 UnknownTransparency ( Symbol , Span ) ,
@@ -140,6 +141,30 @@ pub enum UsedBy {
140141 Linker ,
141142}
142143
144+ #[ derive( Debug , Clone , Encodable , Decodable , HashStable_Generic ) ]
145+ pub struct StrippedCfgItem < ModId = DefId > {
146+ pub parent_module : ModId ,
147+ pub ident : Ident ,
148+ pub cfg : ( CfgEntry , Span ) ,
149+ }
150+
151+ impl < ModId > StrippedCfgItem < ModId > {
152+ pub fn map_mod_id < New > ( self , f : impl FnOnce ( ModId ) -> New ) -> StrippedCfgItem < New > {
153+ StrippedCfgItem { parent_module : f ( self . parent_module ) , ident : self . ident , cfg : self . cfg }
154+ }
155+ }
156+
157+ #[ derive( Encodable , Decodable , Clone , Debug , PartialEq , Eq , Hash ) ]
158+ #[ derive( HashStable_Generic , PrintAttribute ) ]
159+ pub enum CfgEntry {
160+ All ( ThinVec < CfgEntry > , Span ) ,
161+ Any ( ThinVec < CfgEntry > , Span ) ,
162+ Not ( Box < CfgEntry > , Span ) ,
163+ Bool ( bool , Span ) ,
164+ NameValue { name : Symbol , name_span : Span , value : Option < ( Symbol , Span ) > , span : Span } ,
165+ Version ( Option < RustcVersion > , Span ) ,
166+ }
167+
143168/// Represents parsed *built-in* inert attributes.
144169///
145170/// ## Overview
0 commit comments