@@ -14,7 +14,6 @@ use rustc_hir as hir;
1414use rustc_hir:: Attribute ;
1515use rustc_hir:: attrs:: { self , AttributeKind , CfgEntry , CfgHideShow , HideOrShow } ;
1616use rustc_middle:: ty:: TyCtxt ;
17- use rustc_session:: parse:: ParseSess ;
1817use rustc_span:: symbol:: { Symbol , sym} ;
1918use rustc_span:: { DUMMY_SP , Span } ;
2019
@@ -206,30 +205,6 @@ impl Cfg {
206205 Self :: parse_nested ( cfg, & FxHashSet :: default ( ) ) . map ( |ret| ret. unwrap ( ) )
207206 }
208207
209- /// Checks whether the given configuration can be matched in the current session.
210- ///
211- /// Equivalent to `attr::cfg_matches`.
212- pub ( crate ) fn matches ( & self , psess : & ParseSess ) -> bool {
213- fn cfg_matches ( cfg : & CfgEntry , psess : & ParseSess ) -> bool {
214- match cfg {
215- CfgEntry :: Bool ( v, _) => * v,
216- CfgEntry :: Not ( child, _) => !cfg_matches ( child, psess) ,
217- CfgEntry :: All ( sub_cfgs, _) => {
218- sub_cfgs. iter ( ) . all ( |sub_cfg| cfg_matches ( sub_cfg, psess) )
219- }
220- CfgEntry :: Any ( sub_cfgs, _) => {
221- sub_cfgs. iter ( ) . any ( |sub_cfg| cfg_matches ( sub_cfg, psess) )
222- }
223- CfgEntry :: NameValue { name, value, .. } => psess. config . contains ( & ( * name, * value) ) ,
224- CfgEntry :: Version ( ..) => {
225- // FIXME: should be handled.
226- false
227- }
228- }
229- }
230- cfg_matches ( & self . 0 , psess)
231- }
232-
233208 /// Renders the configuration for human display, as a short HTML description.
234209 pub ( crate ) fn render_short_html ( & self ) -> String {
235210 let mut msg = Display ( & self . 0 , Format :: ShortHtml ) . to_string ( ) ;
@@ -320,6 +295,10 @@ impl Cfg {
320295 fn omit_preposition ( & self ) -> bool {
321296 matches ! ( self . 0 , CfgEntry :: Bool ( ..) )
322297 }
298+
299+ pub ( crate ) fn inner ( & self ) -> & CfgEntry {
300+ & self . 0
301+ }
323302}
324303
325304impl ops:: Not for Cfg {
0 commit comments