@@ -88,7 +88,7 @@ impl<'a, T: Eq + Hash + Copy + 'a> Extend<&'a T> for ExpectedValues<T> {
8888
8989/// Disallow builtin cfgs from the CLI.
9090pub ( crate ) fn disallow_cfgs ( sess : & Session , user_cfgs : & Cfg ) {
91- let disallow = |cfg : & ( Symbol , Option < Symbol > ) , controlled_by| {
91+ let disallow_controlled_by = |cfg : & ( Symbol , Option < Symbol > ) , controlled_by| {
9292 let cfg_name = cfg. 0 ;
9393 let cfg = if let Some ( value) = cfg. 1 {
9494 format ! ( r#"{}="{}""# , cfg_name, value)
@@ -102,6 +102,9 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
102102 BuiltinLintDiag :: UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by } ,
103103 )
104104 } ;
105+ let disallow = |cfg : & ( Symbol , Option < Symbol > ) , controlled_by| {
106+ disallow_controlled_by ( cfg, Some ( controlled_by) ) ;
107+ } ;
105108
106109 // We want to restrict setting builtin cfgs that will produce incoherent behavior
107110 // between the cfg and the rustc cli flag that sets it.
@@ -147,6 +150,7 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
147150 | ( sym:: target_has_reliable_f128, None | Some ( _) )
148151 | ( sym:: target_has_reliable_f128_math, None | Some ( _) )
149152 | ( sym:: target_thread_local, None ) => disallow ( cfg, "--target" ) ,
153+ ( sym:: has_cfg_version, None ) => disallow_controlled_by ( cfg, None ) ,
150154 ( sym:: fmt_debug, None | Some ( _) ) => disallow ( cfg, "-Z fmt-debug" ) ,
151155 ( sym:: emscripten_wasm_eh, None | Some ( _) ) => disallow ( cfg, "-Z emscripten_wasm_eh" ) ,
152156 _ => { }
@@ -310,6 +314,8 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {
310314 ins_none ! ( sym:: contract_checks) ;
311315 }
312316
317+ ins_none ! ( sym:: has_cfg_version) ;
318+
313319 ret
314320}
315321
@@ -472,6 +478,8 @@ impl CheckCfg {
472478 ins ! ( sym:: ub_checks, no_values) ;
473479 ins ! ( sym:: contract_checks, no_values) ;
474480
481+ ins ! ( sym:: has_cfg_version, no_values) ;
482+
475483 ins ! ( sym:: unix, no_values) ;
476484 ins ! ( sym:: windows, no_values) ;
477485 }
0 commit comments