diff options
| author | bors <bors@rust-lang.org> | 2024-01-13 02:13:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-13 02:13:20 +0000 |
| commit | f1f8687b06a5908dd096f51da32347b3313279db (patch) | |
| tree | d4ae83554922e0450e2e527a7c69e91c86e9812b /compiler/rustc_session/src | |
| parent | 182537456bf3bbaed59a8ad9ee3a3b58cdce776d (diff) | |
| parent | 29afbbd5a9da3e2b081f69f23114c687b9c479a3 (diff) | |
| download | rust-f1f8687b06a5908dd096f51da32347b3313279db.tar.gz rust-f1f8687b06a5908dd096f51da32347b3313279db.zip | |
Auto merge of #118924 - Urgau:check-cfg-exclude-well-known-from-diag, r=petrochenkov
Exclude well known names from showing a suggestion in check-cfg This PR adds an exclusion for well known names from showing in suggestions of check-cfg/`unexpected_cfgs`. Follow-up to https://github.com/rust-lang/rust/pull/118213 and fixes https://github.com/rust-lang/rust/pull/118213#issuecomment-1854189934. r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 20bea153793..fe1166457ba 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1380,6 +1380,8 @@ pub struct CheckCfg { pub exhaustive_values: bool, /// All the expected values for a config name pub expecteds: FxHashMap<Symbol, ExpectedValues<Symbol>>, + /// Well known names (only used for diagnostics purposes) + pub well_known_names: FxHashSet<Symbol>, } pub enum ExpectedValues<T> { @@ -1432,9 +1434,10 @@ impl CheckCfg { }; macro_rules! ins { - ($name:expr, $values:expr) => { + ($name:expr, $values:expr) => {{ + self.well_known_names.insert($name); self.expecteds.entry($name).or_insert_with($values) - }; + }}; } // Symbols are inserted in alphabetical order as much as possible. |
