diff options
| author | Loïc BRANSTETT <lolo.branstett@numericable.fr> | 2022-02-20 01:26:52 +0100 |
|---|---|---|
| committer | Loïc BRANSTETT <lolo.branstett@numericable.fr> | 2022-02-23 13:22:23 +0100 |
| commit | 8d3de56da1eba68d012977d4c743d5eaaa1baee8 (patch) | |
| tree | f9e20f36386f0fcb218504528db33c9ff1561a81 /compiler/rustc_interface | |
| parent | 3d234770b1c83840d18305e8625da38e97da3174 (diff) | |
| download | rust-8d3de56da1eba68d012977d4c743d5eaaa1baee8.tar.gz rust-8d3de56da1eba68d012977d4c743d5eaaa1baee8.zip | |
Continue improvements on the --check-cfg implementation
- Test the combinations of --check-cfg with partial values() and --cfg - Test that we detect unexpected value when none are expected
Diffstat (limited to 'compiler/rustc_interface')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 5e0d59bf1b1..91ced2a2d90 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -183,12 +183,10 @@ pub fn parse_check_cfg(specs: Vec<String>) -> CheckCfg { } else if meta_item.has_name(sym::values) { if let Some((name, values)) = args.split_first() { if name.is_word() && name.ident().is_some() { - let values_valid = cfg - .values_valid - .get_or_insert_with(|| FxHashMap::default()); let ident = name.ident().expect("multi-segment cfg key"); - let ident_values = values_valid - .entry(ident.to_string()) + let ident_values = cfg + .values_valid + .entry(ident.name.to_string()) .or_insert_with(|| FxHashSet::default()); for val in values { @@ -225,10 +223,8 @@ pub fn parse_check_cfg(specs: Vec<String>) -> CheckCfg { ); } - if let Some(values_valid) = &cfg.values_valid { - if let Some(names_valid) = &mut cfg.names_valid { - names_valid.extend(values_valid.keys().cloned()); - } + if let Some(names_valid) = &mut cfg.names_valid { + names_valid.extend(cfg.values_valid.keys().cloned()); } cfg }) |
