about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-07-31 23:39:38 +0200
committerGitHub <noreply@github.com>2022-07-31 23:39:38 +0200
commite820ecdba115e56d3d1cb0df169463a23a28fabd (patch)
tree37b65f75c372f11543405fc80fe66fcc2a02bfc3 /compiler
parent3405e402faf413ef4633142225228c260a91dd9d (diff)
parentebf4cc361e0d0f11a25b42372bd629953365d17e (diff)
downloadrust-e820ecdba115e56d3d1cb0df169463a23a28fabd.tar.gz
rust-e820ecdba115e56d3d1cb0df169463a23a28fabd.zip
Rollup merge of #99519 - Urgau:check-cfg-implicit, r=petrochenkov
Remove implicit names and values from `--cfg` in `--check-cfg`

This PR remove the implicit names and values from `--cfg` in `--check-cfg` because the behavior is quite surprising but also because it's really easy to inadvertently really on the implicitness and when the `--cfg` is not set anymore to have an unexpected warning from an unexpected condition that pass with the implicitness.

This change in behavior will also enable us to warn when an unexpected `--cfg` is passed, ex: the user wrote `--cfg=unstabl` instead of `--cfg=unstable`. The implementation of the warning will be done in a follow-up PR.

cc `@petrochenkov`
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_interface/src/util.rs1
-rw-r--r--compiler/rustc_session/src/config.rs14
2 files changed, 0 insertions, 15 deletions
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs
index 4c64e679b95..5e5596f13c8 100644
--- a/compiler/rustc_interface/src/util.rs
+++ b/compiler/rustc_interface/src/util.rs
@@ -117,7 +117,6 @@ pub fn create_session(
 
     let mut check_cfg = config::to_crate_check_config(check_cfg);
     check_cfg.fill_well_known();
-    check_cfg.fill_actual(&cfg);
 
     sess.parse_sess.config = cfg;
     sess.parse_sess.check_config = check_cfg;
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 70f942a6508..6a8298605a2 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -1159,20 +1159,6 @@ impl CrateCheckConfig {
         self.fill_well_known_names();
         self.fill_well_known_values();
     }
-
-    /// Fills a `CrateCheckConfig` with configuration names and values that are actually active.
-    pub fn fill_actual(&mut self, cfg: &CrateConfig) {
-        for &(k, v) in cfg {
-            if let Some(names_valid) = &mut self.names_valid {
-                names_valid.insert(k);
-            }
-            if let Some(v) = v {
-                self.values_valid.entry(k).and_modify(|values| {
-                    values.insert(v);
-                });
-            }
-        }
-    }
 }
 
 pub fn build_configuration(sess: &Session, mut user_cfg: CrateConfig) -> CrateConfig {