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`
This commit is contained in:
commit
f1f8687b06
12 changed files with 15 additions and 39 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue