Remove side table of future incompatibility info
Moves this information to a direct field of Lint, which is where it belongs.
This commit is contained in:
parent
c1abc30660
commit
7abb1fafce
@ -4,11 +4,12 @@
|
||||
//! compiler code, rather than using their own custom pass. Those
|
||||
//! lints are all available in `rustc_lint::builtin`.
|
||||
|
||||
use crate::lint::{LintPass, LateLintPass, LintArray};
|
||||
use crate::lint::{LintPass, LateLintPass, LintArray, FutureIncompatibleInfo};
|
||||
use crate::middle::stability;
|
||||
use crate::session::Session;
|
||||
use errors::{Applicability, DiagnosticBuilder, pluralise};
|
||||
use syntax::ast;
|
||||
use syntax::edition::Edition;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::Symbol;
|
||||
|
||||
@ -125,7 +126,11 @@ declare_lint! {
|
||||
declare_lint! {
|
||||
pub PRIVATE_IN_PUBLIC,
|
||||
Warn,
|
||||
"detect private items in public interfaces not caught by the old implementation"
|
||||
"detect private items in public interfaces not caught by the old implementation",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -137,13 +142,21 @@ declare_lint! {
|
||||
declare_lint! {
|
||||
pub PUB_USE_OF_PRIVATE_EXTERN_CRATE,
|
||||
Deny,
|
||||
"detect public re-exports of private extern crates"
|
||||
"detect public re-exports of private extern crates",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub INVALID_TYPE_PARAM_DEFAULT,
|
||||
Deny,
|
||||
"type parameter default erroneously allowed in invalid location"
|
||||
"type parameter default erroneously allowed in invalid location",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -155,56 +168,92 @@ declare_lint! {
|
||||
declare_lint! {
|
||||
pub SAFE_EXTERN_STATICS,
|
||||
Deny,
|
||||
"safe access to extern statics was erroneously allowed"
|
||||
"safe access to extern statics was erroneously allowed",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #36247 <https://github.com/rust-lang/rust/issues/36247>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub SAFE_PACKED_BORROWS,
|
||||
Warn,
|
||||
"safe borrows of fields of packed structs were was erroneously allowed"
|
||||
"safe borrows of fields of packed structs were was erroneously allowed",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #46043 <https://github.com/rust-lang/rust/issues/46043>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub PATTERNS_IN_FNS_WITHOUT_BODY,
|
||||
Warn,
|
||||
"patterns in functions without body were erroneously allowed"
|
||||
"patterns in functions without body were erroneously allowed",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub LEGACY_DIRECTORY_OWNERSHIP,
|
||||
Deny,
|
||||
"non-inline, non-`#[path]` modules (e.g., `mod foo;`) were erroneously allowed in some files \
|
||||
not named `mod.rs`"
|
||||
not named `mod.rs`",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #37872 <https://github.com/rust-lang/rust/issues/37872>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub LEGACY_CONSTRUCTOR_VISIBILITY,
|
||||
Deny,
|
||||
"detects use of struct constructors that would be invisible with new visibility rules"
|
||||
"detects use of struct constructors that would be invisible with new visibility rules",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #39207 <https://github.com/rust-lang/rust/issues/39207>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub MISSING_FRAGMENT_SPECIFIER,
|
||||
Deny,
|
||||
"detects missing fragment specifiers in unused `macro_rules!` patterns"
|
||||
"detects missing fragment specifiers in unused `macro_rules!` patterns",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
|
||||
Deny,
|
||||
"detects parenthesized generic parameters in type and module names"
|
||||
"detects parenthesized generic parameters in type and module names",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #42238 <https://github.com/rust-lang/rust/issues/42238>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub LATE_BOUND_LIFETIME_ARGUMENTS,
|
||||
Warn,
|
||||
"detects generic lifetime arguments in path segments with late bound lifetime parameters"
|
||||
"detects generic lifetime arguments in path segments with late bound lifetime parameters",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub ORDER_DEPENDENT_TRAIT_OBJECTS,
|
||||
Deny,
|
||||
"trait-object types were treated as different depending on marker-trait order"
|
||||
"trait-object types were treated as different depending on marker-trait order",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -247,7 +296,11 @@ declare_lint! {
|
||||
declare_lint! {
|
||||
pub TYVAR_BEHIND_RAW_POINTER,
|
||||
Warn,
|
||||
"raw pointer to an inference variable"
|
||||
"raw pointer to an inference variable",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -266,19 +319,33 @@ declare_lint! {
|
||||
pub ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
|
||||
Allow,
|
||||
"fully qualified paths that start with a module name \
|
||||
instead of `crate`, `self`, or an extern crate name"
|
||||
instead of `crate`, `self`, or an extern crate name",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
|
||||
Warn,
|
||||
"floating-point literals cannot be used in patterns"
|
||||
"floating-point literals cannot be used in patterns",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub UNSTABLE_NAME_COLLISIONS,
|
||||
Warn,
|
||||
"detects name collision with an existing but unstable method"
|
||||
"detects name collision with an existing but unstable method",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #48919 <https://github.com/rust-lang/rust/issues/48919>",
|
||||
edition: None,
|
||||
// Note: this item represents future incompatibility of all unstable functions in the
|
||||
// standard library, and thus should never be removed or changed to an error.
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -296,7 +363,11 @@ declare_lint! {
|
||||
declare_lint! {
|
||||
pub DUPLICATE_MACRO_EXPORTS,
|
||||
Deny,
|
||||
"detects duplicate macro exports"
|
||||
"detects duplicate macro exports",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #35896 <https://github.com/rust-lang/rust/issues/35896>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -320,13 +391,21 @@ declare_lint! {
|
||||
declare_lint! {
|
||||
pub WHERE_CLAUSES_OBJECT_SAFETY,
|
||||
Warn,
|
||||
"checks the object safety of where clauses"
|
||||
"checks the object safety of where clauses",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #51443 <https://github.com/rust-lang/rust/issues/51443>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
|
||||
Warn,
|
||||
"detects proc macro derives using inaccessible names from parent modules"
|
||||
"detects proc macro derives using inaccessible names from parent modules",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #50504 <https://github.com/rust-lang/rust/issues/50504>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -340,7 +419,11 @@ declare_lint! {
|
||||
pub MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
|
||||
Deny,
|
||||
"macro-expanded `macro_export` macros from the current crate \
|
||||
cannot be referred to by absolute paths"
|
||||
cannot be referred to by absolute paths",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -353,7 +436,11 @@ declare_lint! {
|
||||
pub INDIRECT_STRUCTURAL_MATCH,
|
||||
// defaulting to allow until rust-lang/rust#62614 is fixed.
|
||||
Allow,
|
||||
"pattern with const indirectly referencing non-`#[structural_match]` type"
|
||||
"pattern with const indirectly referencing non-`#[structural_match]` type",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
/// Some lints that are buffered from `libsyntax`. See `syntax::early_buffered_lints`.
|
||||
@ -361,7 +448,11 @@ pub mod parser {
|
||||
declare_lint! {
|
||||
pub ILL_FORMED_ATTRIBUTE_INPUT,
|
||||
Warn,
|
||||
"ill-formed attribute inputs that were previously accepted and used in practice"
|
||||
"ill-formed attribute inputs that were previously accepted and used in practice",
|
||||
@future_incompatible = super::FutureIncompatibleInfo {
|
||||
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
@ -387,25 +478,41 @@ declare_lint! {
|
||||
declare_lint! {
|
||||
pub AMBIGUOUS_ASSOCIATED_ITEMS,
|
||||
Deny,
|
||||
"ambiguous associated items"
|
||||
"ambiguous associated items",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub NESTED_IMPL_TRAIT,
|
||||
Warn,
|
||||
"nested occurrence of `impl Trait` type"
|
||||
"nested occurrence of `impl Trait` type",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #59014 <https://github.com/rust-lang/rust/issues/59014>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub MUTABLE_BORROW_RESERVATION_CONFLICT,
|
||||
Warn,
|
||||
"reservation of a two-phased borrow conflicts with other shared borrows"
|
||||
"reservation of a two-phased borrow conflicts with other shared borrows",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #59159 <https://github.com/rust-lang/rust/issues/59159>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub SOFT_UNSTABLE,
|
||||
Deny,
|
||||
"a feature gate that doesn't break dependent crates"
|
||||
"a feature gate that doesn't break dependent crates",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint_pass! {
|
||||
|
@ -22,7 +22,7 @@ use crate::hir::intravisit as hir_visit;
|
||||
use crate::hir::intravisit::Visitor;
|
||||
use crate::hir::map::{definitions::DisambiguatedDefPathData, DefPathData};
|
||||
use crate::lint::{EarlyLintPass, LateLintPass, EarlyLintPassObject, LateLintPassObject};
|
||||
use crate::lint::{Level, Lint, LintId, LintPass, LintBuffer};
|
||||
use crate::lint::{Level, Lint, LintId, LintPass, LintBuffer, FutureIncompatibleInfo};
|
||||
use crate::lint::builtin::BuiltinLintDiagnostics;
|
||||
use crate::lint::levels::{LintLevelSets, LintLevelsBuilder};
|
||||
use crate::middle::privacy::AccessLevels;
|
||||
@ -38,7 +38,6 @@ use std::default::Default as StdDefault;
|
||||
use rustc_data_structures::sync::{ReadGuard, ParallelIterator, join, par_iter};
|
||||
use rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
|
||||
use syntax::ast;
|
||||
use syntax::edition;
|
||||
use syntax::util::lev_distance::find_best_match_for_name;
|
||||
use syntax::visit as ast_visit;
|
||||
use syntax_pos::{MultiSpan, Span, symbol::Symbol};
|
||||
@ -69,10 +68,6 @@ pub struct LintStore {
|
||||
|
||||
/// Map of registered lint groups to what lints they expand to.
|
||||
lint_groups: FxHashMap<&'static str, LintGroup>,
|
||||
|
||||
/// Extra info for future incompatibility lints, describing the
|
||||
/// issue or RFC that caused the incompatibility.
|
||||
future_incompatible: FxHashMap<LintId, FutureIncompatibleInfo>,
|
||||
}
|
||||
|
||||
/// Lints that are buffered up early on in the `Session` before the
|
||||
@ -86,18 +81,6 @@ pub struct BufferedEarlyLint {
|
||||
pub diagnostic: BuiltinLintDiagnostics,
|
||||
}
|
||||
|
||||
/// Extra information for a future incompatibility lint. See the call
|
||||
/// to `register_future_incompatible` in `librustc_lint/lib.rs` for
|
||||
/// guidelines.
|
||||
pub struct FutureIncompatibleInfo {
|
||||
pub id: LintId,
|
||||
/// e.g., a URL for an issue/PR/RFC or error code
|
||||
pub reference: &'static str,
|
||||
/// If this is an edition fixing lint, the edition in which
|
||||
/// this lint becomes obsolete
|
||||
pub edition: Option<edition::Edition>,
|
||||
}
|
||||
|
||||
/// The target of the `by_name` map, which accounts for renaming/deprecation.
|
||||
enum TargetLint {
|
||||
/// A direct lint target
|
||||
@ -152,7 +135,6 @@ impl LintStore {
|
||||
late_passes: vec![],
|
||||
late_module_passes: vec![],
|
||||
by_name: Default::default(),
|
||||
future_incompatible: Default::default(),
|
||||
lint_groups: Default::default(),
|
||||
}
|
||||
}
|
||||
@ -198,36 +180,31 @@ impl LintStore {
|
||||
if self.by_name.insert(lint.name_lower(), Id(id)).is_some() {
|
||||
bug!("duplicate specification of lint {}", lint.name_lower())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register_future_incompatible(&mut self,
|
||||
lints: Vec<FutureIncompatibleInfo>) {
|
||||
if let Some(FutureIncompatibleInfo { edition, .. }) = lint.future_incompatible {
|
||||
if let Some(edition) = edition {
|
||||
self.lint_groups.entry(edition.lint_name())
|
||||
.or_insert(LintGroup {
|
||||
lint_ids: vec![],
|
||||
from_plugin: lint.is_plugin,
|
||||
depr: None,
|
||||
})
|
||||
.lint_ids.push(id);
|
||||
}
|
||||
|
||||
for edition in edition::ALL_EDITIONS {
|
||||
let lints = lints.iter().filter(|f| f.edition == Some(*edition)).map(|f| f.id)
|
||||
.collect::<Vec<_>>();
|
||||
if !lints.is_empty() {
|
||||
self.register_group(false, edition.lint_name(), None, lints)
|
||||
self.lint_groups.entry("future_incompatible")
|
||||
.or_insert(LintGroup {
|
||||
lint_ids: vec![],
|
||||
from_plugin: lint.is_plugin,
|
||||
depr: None,
|
||||
})
|
||||
.lint_ids.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
let mut future_incompatible = Vec::with_capacity(lints.len());
|
||||
for lint in lints {
|
||||
future_incompatible.push(lint.id);
|
||||
self.future_incompatible.insert(lint.id, lint);
|
||||
}
|
||||
|
||||
self.register_group(
|
||||
false,
|
||||
"future_incompatible",
|
||||
None,
|
||||
future_incompatible,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn future_incompatible(&self, id: LintId) -> Option<&FutureIncompatibleInfo> {
|
||||
self.future_incompatible.get(&id)
|
||||
pub fn future_incompatible(&self, id: LintId) -> Option<FutureIncompatibleInfo> {
|
||||
id.lint.future_incompatible
|
||||
}
|
||||
|
||||
pub fn register_group_alias(
|
||||
|
@ -45,7 +45,7 @@ use syntax_pos::Span;
|
||||
|
||||
pub use crate::lint::context::{LateContext, EarlyContext, LintContext, LintStore,
|
||||
check_crate, check_ast_crate, late_lint_mod, CheckLintNameResult,
|
||||
FutureIncompatibleInfo, BufferedEarlyLint,};
|
||||
BufferedEarlyLint,};
|
||||
|
||||
/// Specification of a single lint.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
@ -77,9 +77,21 @@ pub struct Lint {
|
||||
/// `true` if this lint is reported even inside expansions of external macros.
|
||||
pub report_in_external_macro: bool,
|
||||
|
||||
pub future_incompatible: Option<FutureIncompatibleInfo>,
|
||||
|
||||
pub is_plugin: bool,
|
||||
}
|
||||
|
||||
/// Extra information for a future incompatibility lint.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct FutureIncompatibleInfo {
|
||||
/// e.g., a URL for an issue/PR/RFC or error code
|
||||
pub reference: &'static str,
|
||||
/// If this is an edition fixing lint, the edition in which
|
||||
/// this lint becomes obsolete
|
||||
pub edition: Option<Edition>,
|
||||
}
|
||||
|
||||
impl Lint {
|
||||
pub const fn default_fields_for_macro() -> Self {
|
||||
Lint {
|
||||
@ -89,6 +101,7 @@ impl Lint {
|
||||
edition_lint_opts: None,
|
||||
is_plugin: false,
|
||||
report_in_external_macro: false,
|
||||
future_incompatible: None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +135,8 @@ macro_rules! declare_lint {
|
||||
$vis $NAME, $Level, $desc,
|
||||
);
|
||||
);
|
||||
($vis: vis $NAME: ident, $Level: ident, $desc: expr, $($v:ident),*) => (
|
||||
($vis: vis $NAME: ident, $Level: ident, $desc: expr,
|
||||
$(@future_incompatible = $fi:expr;)? $($v:ident),*) => (
|
||||
$vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
|
||||
name: stringify!($NAME),
|
||||
default_level: $crate::lint::$Level,
|
||||
@ -130,6 +144,7 @@ macro_rules! declare_lint {
|
||||
edition_lint_opts: None,
|
||||
is_plugin: false,
|
||||
$($v: true,)*
|
||||
$(future_incompatible: Some($fi),)*
|
||||
..$crate::lint::Lint::default_fields_for_macro()
|
||||
};
|
||||
);
|
||||
@ -171,6 +186,7 @@ macro_rules! declare_tool_lint {
|
||||
desc: $desc,
|
||||
edition_lint_opts: None,
|
||||
report_in_external_macro: $external,
|
||||
future_incompatible: None,
|
||||
is_plugin: true,
|
||||
};
|
||||
);
|
||||
|
@ -27,6 +27,7 @@ use rustc::hir::def::{Res, DefKind};
|
||||
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc::ty::{self, Ty, TyCtxt, layout::VariantIdx};
|
||||
use rustc::{lint, util};
|
||||
use rustc::lint::FutureIncompatibleInfo;
|
||||
use hir::Node;
|
||||
use util::nodemap::HirIdSet;
|
||||
use lint::{LateContext, LintContext, LintArray};
|
||||
@ -601,7 +602,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
|
||||
declare_lint! {
|
||||
pub ANONYMOUS_PARAMETERS,
|
||||
Allow,
|
||||
"detects anonymous parameters"
|
||||
"detects anonymous parameters",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint_pass!(
|
||||
@ -1423,7 +1428,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnameableTestItems {
|
||||
declare_lint! {
|
||||
pub KEYWORD_IDENTS,
|
||||
Allow,
|
||||
"detects edition keywords being used as an identifier"
|
||||
"detects edition keywords being used as an identifier",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint_pass!(
|
||||
|
@ -33,13 +33,11 @@ use rustc::lint;
|
||||
use rustc::lint::{EarlyContext, LateContext, LateLintPass, EarlyLintPass, LintPass, LintArray};
|
||||
use rustc::lint::builtin::{
|
||||
BARE_TRAIT_OBJECTS,
|
||||
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
|
||||
ELIDED_LIFETIMES_IN_PATHS,
|
||||
EXPLICIT_OUTLIVES_REQUIREMENTS,
|
||||
INTRA_DOC_LINK_RESOLUTION_FAILURE,
|
||||
MISSING_DOC_CODE_EXAMPLES,
|
||||
PRIVATE_DOC_TESTS,
|
||||
parser::ILL_FORMED_ATTRIBUTE_INPUT,
|
||||
};
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::DefId;
|
||||
@ -47,11 +45,9 @@ use rustc::ty::query::Providers;
|
||||
use rustc::ty::TyCtxt;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::edition::Edition;
|
||||
use syntax_pos::Span;
|
||||
|
||||
use lint::LintId;
|
||||
use lint::FutureIncompatibleInfo;
|
||||
|
||||
use redundant_semicolon::*;
|
||||
use nonstandard_style::*;
|
||||
@ -276,159 +272,6 @@ pub fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool)
|
||||
MISSING_DOC_CODE_EXAMPLES,
|
||||
PRIVATE_DOC_TESTS);
|
||||
|
||||
// Guidelines for creating a future incompatibility lint:
|
||||
//
|
||||
// - Create a lint defaulting to warn as normal, with ideally the same error
|
||||
// message you would normally give
|
||||
// - Add a suitable reference, typically an RFC or tracking issue. Go ahead
|
||||
// and include the full URL, sort items in ascending order of issue numbers.
|
||||
// - Later, change lint to error
|
||||
// - Eventually, remove lint
|
||||
store.register_future_incompatible(vec![
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(PRIVATE_IN_PUBLIC),
|
||||
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(PUB_USE_OF_PRIVATE_EXTERN_CRATE),
|
||||
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(PATTERNS_IN_FNS_WITHOUT_BODY),
|
||||
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(DUPLICATE_MACRO_EXPORTS),
|
||||
reference: "issue #35896 <https://github.com/rust-lang/rust/issues/35896>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(KEYWORD_IDENTS),
|
||||
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(SAFE_EXTERN_STATICS),
|
||||
reference: "issue #36247 <https://github.com/rust-lang/rust/issues/36247>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(INVALID_TYPE_PARAM_DEFAULT),
|
||||
reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(LEGACY_DIRECTORY_OWNERSHIP),
|
||||
reference: "issue #37872 <https://github.com/rust-lang/rust/issues/37872>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(LEGACY_CONSTRUCTOR_VISIBILITY),
|
||||
reference: "issue #39207 <https://github.com/rust-lang/rust/issues/39207>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(MISSING_FRAGMENT_SPECIFIER),
|
||||
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(ILLEGAL_FLOATING_POINT_LITERAL_PATTERN),
|
||||
reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(ANONYMOUS_PARAMETERS),
|
||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES),
|
||||
reference: "issue #42238 <https://github.com/rust-lang/rust/issues/42238>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(LATE_BOUND_LIFETIME_ARGUMENTS),
|
||||
reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(SAFE_PACKED_BORROWS),
|
||||
reference: "issue #46043 <https://github.com/rust-lang/rust/issues/46043>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(ORDER_DEPENDENT_TRAIT_OBJECTS),
|
||||
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(TYVAR_BEHIND_RAW_POINTER),
|
||||
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(UNSTABLE_NAME_COLLISIONS),
|
||||
reference: "issue #48919 <https://github.com/rust-lang/rust/issues/48919>",
|
||||
edition: None,
|
||||
// Note: this item represents future incompatibility of all unstable functions in the
|
||||
// standard library, and thus should never be removed or changed to an error.
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE),
|
||||
reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(WHERE_CLAUSES_OBJECT_SAFETY),
|
||||
reference: "issue #51443 <https://github.com/rust-lang/rust/issues/51443>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(PROC_MACRO_DERIVE_RESOLUTION_FALLBACK),
|
||||
reference: "issue #50504 <https://github.com/rust-lang/rust/issues/50504>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS),
|
||||
reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(ILL_FORMED_ATTRIBUTE_INPUT),
|
||||
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(AMBIGUOUS_ASSOCIATED_ITEMS),
|
||||
reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(NESTED_IMPL_TRAIT),
|
||||
reference: "issue #59014 <https://github.com/rust-lang/rust/issues/59014>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(MUTABLE_BORROW_RESERVATION_CONFLICT),
|
||||
reference: "issue #59159 <https://github.com/rust-lang/rust/issues/59159>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(INDIRECT_STRUCTURAL_MATCH),
|
||||
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
|
||||
edition: None,
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(SOFT_UNSTABLE),
|
||||
reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>",
|
||||
edition: None,
|
||||
},
|
||||
]);
|
||||
|
||||
// Register renamed and removed lints.
|
||||
store.register_renamed("single_use_lifetime", "single_use_lifetimes");
|
||||
store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths");
|
||||
|
Loading…
x
Reference in New Issue
Block a user