Remove --check-cfg checking of --cfg args
This commit is contained in:
parent
78efca8845
commit
f5023e4c76
6 changed files with 4 additions and 47 deletions
|
@ -128,12 +128,6 @@ lint_builtin_type_alias_generic_bounds = bounds on generic parameters are not en
|
||||||
lint_builtin_type_alias_where_clause = where clauses are not enforced in type aliases
|
lint_builtin_type_alias_where_clause = where clauses are not enforced in type aliases
|
||||||
.suggestion = the clause will not be checked when the type alias is used, and should be removed
|
.suggestion = the clause will not be checked when the type alias is used, and should be removed
|
||||||
|
|
||||||
lint_builtin_unexpected_cli_config_name = unexpected `{$name}` as condition name
|
|
||||||
.help = was set with `--cfg` but isn't in the `--check-cfg` expected names
|
|
||||||
|
|
||||||
lint_builtin_unexpected_cli_config_value = unexpected condition value `{$value}` for condition name `{$name}`
|
|
||||||
.help = was set with `--cfg` but isn't in the `--check-cfg` expected values
|
|
||||||
|
|
||||||
lint_builtin_unpermitted_type_init_label = this code causes undefined behavior when executed
|
lint_builtin_unpermitted_type_init_label = this code causes undefined behavior when executed
|
||||||
lint_builtin_unpermitted_type_init_label_suggestion = help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
lint_builtin_unpermitted_type_init_label_suggestion = help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ use crate::{
|
||||||
BuiltinMutablesTransmutes, BuiltinNoMangleGeneric, BuiltinNonShorthandFieldPatterns,
|
BuiltinMutablesTransmutes, BuiltinNoMangleGeneric, BuiltinNonShorthandFieldPatterns,
|
||||||
BuiltinSpecialModuleNameUsed, BuiltinTrivialBounds, BuiltinTypeAliasGenericBounds,
|
BuiltinSpecialModuleNameUsed, BuiltinTrivialBounds, BuiltinTypeAliasGenericBounds,
|
||||||
BuiltinTypeAliasGenericBoundsSuggestion, BuiltinTypeAliasWhereClause,
|
BuiltinTypeAliasGenericBoundsSuggestion, BuiltinTypeAliasWhereClause,
|
||||||
BuiltinUnexpectedCliConfigName, BuiltinUnexpectedCliConfigValue,
|
|
||||||
BuiltinUngatedAsyncFnTrackCaller, BuiltinUnpermittedTypeInit,
|
BuiltinUngatedAsyncFnTrackCaller, BuiltinUnpermittedTypeInit,
|
||||||
BuiltinUnpermittedTypeInitSub, BuiltinUnreachablePub, BuiltinUnsafe,
|
BuiltinUnpermittedTypeInitSub, BuiltinUnreachablePub, BuiltinUnsafe,
|
||||||
BuiltinUnstableFeatures, BuiltinUnusedDocComment, BuiltinUnusedDocCommentSub,
|
BuiltinUnstableFeatures, BuiltinUnusedDocComment, BuiltinUnusedDocCommentSub,
|
||||||
|
@ -60,7 +59,6 @@ use rustc_middle::ty::GenericArgKind;
|
||||||
use rustc_middle::ty::ToPredicate;
|
use rustc_middle::ty::ToPredicate;
|
||||||
use rustc_middle::ty::TypeVisitableExt;
|
use rustc_middle::ty::TypeVisitableExt;
|
||||||
use rustc_middle::ty::{self, Ty, TyCtxt, VariantDef};
|
use rustc_middle::ty::{self, Ty, TyCtxt, VariantDef};
|
||||||
use rustc_session::config::ExpectedValues;
|
|
||||||
use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason};
|
use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason};
|
||||||
use rustc_span::edition::Edition;
|
use rustc_span::edition::Edition;
|
||||||
use rustc_span::source_map::Spanned;
|
use rustc_span::source_map::Spanned;
|
||||||
|
@ -2889,26 +2887,3 @@ impl EarlyLintPass for SpecialModuleName {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use rustc_session::lint::builtin::UNEXPECTED_CFGS;
|
|
||||||
|
|
||||||
declare_lint_pass!(UnexpectedCfgs => [UNEXPECTED_CFGS]);
|
|
||||||
|
|
||||||
impl EarlyLintPass for UnexpectedCfgs {
|
|
||||||
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
|
|
||||||
let cfg = &cx.sess().parse_sess.config;
|
|
||||||
let check_cfg = &cx.sess().parse_sess.check_config;
|
|
||||||
for &(name, value) in cfg {
|
|
||||||
match check_cfg.expecteds.get(&name) {
|
|
||||||
Some(ExpectedValues::Some(values)) if !values.contains(&value) => {
|
|
||||||
let value = value.unwrap_or(kw::Empty);
|
|
||||||
cx.emit_lint(UNEXPECTED_CFGS, BuiltinUnexpectedCliConfigValue { name, value });
|
|
||||||
}
|
|
||||||
None if check_cfg.exhaustive_names => {
|
|
||||||
cx.emit_lint(UNEXPECTED_CFGS, BuiltinUnexpectedCliConfigName { name });
|
|
||||||
}
|
|
||||||
_ => { /* expected */ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -179,7 +179,6 @@ early_lint_methods!(
|
||||||
IncompleteInternalFeatures: IncompleteInternalFeatures,
|
IncompleteInternalFeatures: IncompleteInternalFeatures,
|
||||||
RedundantSemicolons: RedundantSemicolons,
|
RedundantSemicolons: RedundantSemicolons,
|
||||||
UnusedDocComment: UnusedDocComment,
|
UnusedDocComment: UnusedDocComment,
|
||||||
UnexpectedCfgs: UnexpectedCfgs,
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -553,21 +553,6 @@ pub enum BuiltinSpecialModuleNameUsed {
|
||||||
Main,
|
Main,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
|
||||||
#[diag(lint_builtin_unexpected_cli_config_name)]
|
|
||||||
#[help]
|
|
||||||
pub struct BuiltinUnexpectedCliConfigName {
|
|
||||||
pub name: Symbol,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
|
||||||
#[diag(lint_builtin_unexpected_cli_config_value)]
|
|
||||||
#[help]
|
|
||||||
pub struct BuiltinUnexpectedCliConfigValue {
|
|
||||||
pub name: Symbol,
|
|
||||||
pub value: Symbol,
|
|
||||||
}
|
|
||||||
|
|
||||||
// deref_into_dyn_supertrait.rs
|
// deref_into_dyn_supertrait.rs
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
#[diag(lint_supertrait_as_deref_target)]
|
#[diag(lint_supertrait_as_deref_target)]
|
||||||
|
|
|
@ -3439,6 +3439,7 @@ declare_lint_pass! {
|
||||||
UNCONDITIONAL_PANIC,
|
UNCONDITIONAL_PANIC,
|
||||||
UNCONDITIONAL_RECURSION,
|
UNCONDITIONAL_RECURSION,
|
||||||
UNDEFINED_NAKED_FUNCTION_ABI,
|
UNDEFINED_NAKED_FUNCTION_ABI,
|
||||||
|
UNEXPECTED_CFGS,
|
||||||
UNFULFILLED_LINT_EXPECTATIONS,
|
UNFULFILLED_LINT_EXPECTATIONS,
|
||||||
UNINHABITED_STATIC,
|
UNINHABITED_STATIC,
|
||||||
UNKNOWN_CRATE_TYPES,
|
UNKNOWN_CRATE_TYPES,
|
||||||
|
|
|
@ -35,6 +35,9 @@ and `cfg!(name = "value")` call. It will check that the `"value"` specified is p
|
||||||
list of expected values. If `"value"` is not in it, then `rustc` will report an `unexpected_cfgs`
|
list of expected values. If `"value"` is not in it, then `rustc` will report an `unexpected_cfgs`
|
||||||
lint diagnostic. The default diagnostic level for this lint is `Warn`.
|
lint diagnostic. The default diagnostic level for this lint is `Warn`.
|
||||||
|
|
||||||
|
The command line `--cfg` arguments are currently *NOT* checked but may very well be checked in
|
||||||
|
the future.
|
||||||
|
|
||||||
To enable checking of values, but to provide an empty set of expected values, use these forms:
|
To enable checking of values, but to provide an empty set of expected values, use these forms:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue