@@ -59,11 +59,11 @@ fn is_all_cfg(cfg: &CfgEntry) -> bool {
5959 }
6060}
6161
62- fn strip_hidden ( cfg : & CfgEntry , hidden : & FxHashSet < SimpleCfg > ) -> Option < CfgEntry > {
62+ fn strip_hidden ( cfg : & CfgEntry , hidden : & FxHashSet < NameValueCfg > ) -> Option < CfgEntry > {
6363 match cfg {
6464 CfgEntry :: Bool ( ..) => Some ( cfg. clone ( ) ) ,
6565 CfgEntry :: NameValue { .. } => {
66- if !hidden. contains ( & SimpleCfg :: from ( cfg) ) {
66+ if !hidden. contains ( & NameValueCfg :: from ( cfg) ) {
6767 Some ( cfg. clone ( ) )
6868 } else {
6969 None
@@ -109,7 +109,7 @@ impl Cfg {
109109 /// Parses a `MetaItemInner` into a `Cfg`.
110110 fn parse_nested (
111111 nested_cfg : & MetaItemInner ,
112- exclude : & FxHashSet < SimpleCfg > ,
112+ exclude : & FxHashSet < NameValueCfg > ,
113113 ) -> Result < Option < Cfg > , InvalidCfgError > {
114114 match nested_cfg {
115115 MetaItemInner :: MetaItem ( cfg) => Cfg :: parse_without ( cfg, exclude) ,
@@ -124,7 +124,7 @@ impl Cfg {
124124
125125 fn parse_without (
126126 cfg : & MetaItem ,
127- exclude : & FxHashSet < SimpleCfg > ,
127+ exclude : & FxHashSet < NameValueCfg > ,
128128 ) -> Result < Option < Cfg > , InvalidCfgError > {
129129 let name = match cfg. ident ( ) {
130130 Some ( ident) => ident. name ,
@@ -137,7 +137,7 @@ impl Cfg {
137137 } ;
138138 match cfg. kind {
139139 MetaItemKind :: Word => {
140- if exclude. contains ( & SimpleCfg :: new ( name) ) {
140+ if exclude. contains ( & NameValueCfg :: new ( name) ) {
141141 Ok ( None )
142142 } else {
143143 Ok ( Some ( Cfg ( CfgEntry :: NameValue {
@@ -150,7 +150,7 @@ impl Cfg {
150150 }
151151 MetaItemKind :: NameValue ( ref lit) => match lit. kind {
152152 LitKind :: Str ( value, _) => {
153- if exclude. contains ( & SimpleCfg :: new_value ( name, value) ) {
153+ if exclude. contains ( & NameValueCfg :: new_value ( name, value) ) {
154154 Ok ( None )
155155 } else {
156156 Ok ( Some ( Cfg ( CfgEntry :: NameValue {
@@ -666,12 +666,12 @@ impl fmt::Display for Display<'_> {
666666}
667667
668668#[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
669- struct SimpleCfg {
669+ struct NameValueCfg {
670670 name : Symbol ,
671671 value : Option < Symbol > ,
672672}
673673
674- impl SimpleCfg {
674+ impl NameValueCfg {
675675 fn new ( name : Symbol ) -> Self {
676676 Self { name, value : None }
677677 }
@@ -681,18 +681,18 @@ impl SimpleCfg {
681681 }
682682}
683683
684- impl < ' a > From < & ' a CfgEntry > for SimpleCfg {
684+ impl < ' a > From < & ' a CfgEntry > for NameValueCfg {
685685 fn from ( cfg : & ' a CfgEntry ) -> Self {
686686 match cfg {
687687 CfgEntry :: NameValue { name, value, .. } => {
688- SimpleCfg { name : * name, value : ( * value) . map ( |( v, _) | v) }
688+ NameValueCfg { name : * name, value : ( * value) . map ( |( v, _) | v) }
689689 }
690- _ => SimpleCfg { name : sym:: empty, value : None } ,
690+ _ => NameValueCfg { name : sym:: empty, value : None } ,
691691 }
692692 }
693693}
694694
695- impl < ' a > From < & ' a attrs:: CfgInfo > for SimpleCfg {
695+ impl < ' a > From < & ' a attrs:: CfgInfo > for NameValueCfg {
696696 fn from ( cfg : & ' a attrs:: CfgInfo ) -> Self {
697697 Self { name : cfg. name , value : cfg. value . map ( |( value, _) | value) }
698698 }
@@ -703,7 +703,7 @@ impl<'a> From<&'a attrs::CfgInfo> for SimpleCfg {
703703pub ( crate ) struct CfgInfo {
704704 /// List of currently active `doc(auto_cfg(hide(...)))` cfgs, minus currently active
705705 /// `doc(auto_cfg(show(...)))` cfgs.
706- hidden_cfg : FxHashSet < SimpleCfg > ,
706+ hidden_cfg : FxHashSet < NameValueCfg > ,
707707 /// Current computed `cfg`. Each time we enter a new item, this field is updated as well while
708708 /// taking into account the `hidden_cfg` information.
709709 current_cfg : Cfg ,
@@ -719,9 +719,9 @@ impl Default for CfgInfo {
719719 fn default ( ) -> Self {
720720 Self {
721721 hidden_cfg : FxHashSet :: from_iter ( [
722- SimpleCfg :: new ( sym:: test) ,
723- SimpleCfg :: new ( sym:: doc) ,
724- SimpleCfg :: new ( sym:: doctest) ,
722+ NameValueCfg :: new ( sym:: test) ,
723+ NameValueCfg :: new ( sym:: doc) ,
724+ NameValueCfg :: new ( sym:: doctest) ,
725725 ] ) ,
726726 current_cfg : Cfg ( CfgEntry :: Bool ( true , DUMMY_SP ) ) ,
727727 auto_cfg_active : true ,
@@ -761,7 +761,7 @@ fn handle_auto_cfg_hide_show(
761761 new_hide_attrs : & mut FxHashMap < ( Symbol , Option < Symbol > ) , rustc_span:: Span > ,
762762) {
763763 for value in & attr. values {
764- let simple = SimpleCfg :: from ( value) ;
764+ let simple = NameValueCfg :: from ( value) ;
765765 if attr. kind == HideOrShow :: Show {
766766 if let Some ( span) = new_hide_attrs. get ( & ( simple. name , simple. value ) ) {
767767 show_hide_show_conflict_error ( tcx, attr_span, * span) ;
0 commit comments