2018-11-27 02:59:49 +00:00
|
|
|
//! # Lints in the Rust compiler
|
2015-02-25 23:03:44 +11:00
|
|
|
//!
|
|
|
|
//! This currently only contains the definitions and implementations
|
|
|
|
//! of most of the lints that `rustc` supports directly, it does not
|
|
|
|
//! contain the infrastructure for defining/registering lints. That is
|
2019-07-16 19:08:32 +02:00
|
|
|
//! available in `rustc::lint` and `rustc_driver::plugin` respectively.
|
2015-02-25 22:44:44 +11:00
|
|
|
//!
|
2018-11-27 02:59:49 +00:00
|
|
|
//! ## Note
|
2015-02-25 22:44:44 +11:00
|
|
|
//!
|
|
|
|
//! This API is completely unstable and subject to change.
|
|
|
|
|
2019-02-05 14:37:15 +01:00
|
|
|
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
|
2015-06-09 14:39:23 -07:00
|
|
|
#![cfg_attr(test, feature(test))]
|
2019-10-08 01:14:42 +01:00
|
|
|
#![feature(bool_to_option)]
|
2015-02-25 22:44:44 +11:00
|
|
|
#![feature(box_patterns)]
|
|
|
|
#![feature(box_syntax)]
|
2018-09-26 14:26:46 -07:00
|
|
|
#![feature(nll)]
|
2019-12-22 17:42:04 -05:00
|
|
|
#![recursion_limit = "256"]
|
2018-12-13 16:57:25 +01:00
|
|
|
|
2015-02-25 22:44:44 +11:00
|
|
|
#[macro_use]
|
|
|
|
extern crate rustc;
|
2019-11-12 12:09:20 -05:00
|
|
|
#[macro_use]
|
|
|
|
extern crate rustc_session;
|
2015-02-25 22:44:44 +11:00
|
|
|
|
2019-11-01 12:04:18 +01:00
|
|
|
mod array_into_iter;
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod builtin;
|
2019-12-30 14:11:49 +01:00
|
|
|
mod early;
|
2019-12-30 14:22:46 +01:00
|
|
|
mod late;
|
2019-12-30 19:02:52 +01:00
|
|
|
mod levels;
|
2019-12-22 17:42:04 -05:00
|
|
|
mod non_ascii_idents;
|
2018-11-27 02:59:49 +00:00
|
|
|
mod nonstandard_style;
|
2019-07-30 13:48:39 -04:00
|
|
|
mod redundant_semicolon;
|
2018-11-27 02:59:49 +00:00
|
|
|
mod types;
|
|
|
|
mod unused;
|
|
|
|
|
2017-08-19 03:09:55 +03:00
|
|
|
use rustc::lint;
|
2018-07-12 21:25:02 -05:00
|
|
|
use rustc::lint::builtin::{
|
2019-12-22 17:42:04 -05:00
|
|
|
BARE_TRAIT_OBJECTS, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS,
|
|
|
|
INTRA_DOC_LINK_RESOLUTION_FAILURE, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS,
|
2018-07-12 21:25:02 -05:00
|
|
|
};
|
2020-01-05 10:07:26 +01:00
|
|
|
use rustc::lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass};
|
2019-01-31 01:36:11 +01:00
|
|
|
use rustc::ty::query::Providers;
|
|
|
|
use rustc::ty::TyCtxt;
|
2020-01-05 02:37:57 +01:00
|
|
|
use rustc_hir as hir;
|
|
|
|
use rustc_hir::def_id::DefId;
|
2020-01-05 10:07:26 +01:00
|
|
|
use rustc_session::lint::{LintArray, LintPass};
|
2018-06-21 09:04:50 +02:00
|
|
|
|
2019-12-31 20:15:40 +03:00
|
|
|
use rustc_span::Span;
|
2018-06-21 09:04:50 +02:00
|
|
|
use syntax::ast;
|
2015-02-25 22:44:44 +11:00
|
|
|
|
Add trivial cast lints.
This permits all coercions to be performed in casts, but adds lints to warn in those cases.
Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference.
[breaking change]
* Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed.
* The unused casts lint has gone.
* Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are:
- You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_`
- Casts do not influence inference of integer types. E.g., the following used to type check:
```
let x = 42;
let y = &x as *const u32;
```
Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information:
```
let x: u32 = 42;
let y = &x as *const u32;
```
2015-03-20 17:15:27 +13:00
|
|
|
use lint::LintId;
|
2015-02-25 22:44:44 +11:00
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
use array_into_iter::ArrayIntoIter;
|
2015-09-14 22:36:39 -04:00
|
|
|
use builtin::*;
|
2019-06-15 20:22:07 -07:00
|
|
|
use non_ascii_idents::*;
|
2019-12-22 17:42:04 -05:00
|
|
|
use nonstandard_style::*;
|
|
|
|
use redundant_semicolon::*;
|
2018-12-06 14:03:12 +01:00
|
|
|
use rustc::lint::internal::*;
|
2019-12-22 17:42:04 -05:00
|
|
|
use types::*;
|
|
|
|
use unused::*;
|
2015-09-14 22:36:39 -04:00
|
|
|
|
2018-06-09 17:20:58 +02:00
|
|
|
/// Useful for other parts of the compiler.
|
|
|
|
pub use builtin::SoftLints;
|
2019-12-30 14:11:49 +01:00
|
|
|
pub use early::check_ast_crate;
|
2019-12-30 14:22:46 +01:00
|
|
|
pub use late::check_crate;
|
2018-06-09 17:20:58 +02:00
|
|
|
|
2019-01-31 01:36:11 +01:00
|
|
|
pub fn provide(providers: &mut Providers<'_>) {
|
2019-12-30 19:02:52 +01:00
|
|
|
levels::provide(providers);
|
2019-12-22 17:42:04 -05:00
|
|
|
*providers = Providers { lint_mod, ..*providers };
|
2019-01-31 01:36:11 +01:00
|
|
|
}
|
|
|
|
|
2019-06-21 20:27:44 +02:00
|
|
|
fn lint_mod(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
2019-12-30 14:22:46 +01:00
|
|
|
late::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new());
|
2019-01-31 01:36:11 +01:00
|
|
|
}
|
|
|
|
|
2019-01-18 07:40:55 +01:00
|
|
|
macro_rules! pre_expansion_lint_passes {
|
2019-12-22 17:42:04 -05:00
|
|
|
($macro:path, $args:tt) => {
|
|
|
|
$macro!($args, [KeywordIdents: KeywordIdents, UnusedDocComment: UnusedDocComment,]);
|
|
|
|
};
|
2019-01-18 07:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! early_lint_passes {
|
2019-12-22 17:42:04 -05:00
|
|
|
($macro:path, $args:tt) => {
|
|
|
|
$macro!(
|
|
|
|
$args,
|
|
|
|
[
|
|
|
|
UnusedParens: UnusedParens,
|
|
|
|
UnusedImportBraces: UnusedImportBraces,
|
|
|
|
UnsafeCode: UnsafeCode,
|
|
|
|
AnonymousParameters: AnonymousParameters,
|
|
|
|
EllipsisInclusiveRangePatterns: EllipsisInclusiveRangePatterns::default(),
|
|
|
|
NonCamelCaseTypes: NonCamelCaseTypes,
|
|
|
|
DeprecatedAttr: DeprecatedAttr::new(),
|
|
|
|
WhileTrue: WhileTrue,
|
|
|
|
NonAsciiIdents: NonAsciiIdents,
|
|
|
|
IncompleteFeatures: IncompleteFeatures,
|
|
|
|
RedundantSemicolon: RedundantSemicolon,
|
|
|
|
]
|
|
|
|
);
|
|
|
|
};
|
2019-01-18 07:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! declare_combined_early_pass {
|
|
|
|
([$name:ident], $passes:tt) => (
|
|
|
|
early_lint_methods!(declare_combined_early_lint_pass, [pub $name, $passes]);
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
pre_expansion_lint_passes!(declare_combined_early_pass, [BuiltinCombinedPreExpansionLintPass]);
|
|
|
|
early_lint_passes!(declare_combined_early_pass, [BuiltinCombinedEarlyLintPass]);
|
|
|
|
|
2019-01-31 01:36:11 +01:00
|
|
|
macro_rules! late_lint_passes {
|
2019-12-22 17:42:04 -05:00
|
|
|
($macro:path, $args:tt) => {
|
|
|
|
$macro!(
|
|
|
|
$args,
|
|
|
|
[
|
|
|
|
// FIXME: Look into regression when this is used as a module lint
|
|
|
|
// May Depend on constants elsewhere
|
|
|
|
UnusedBrokenConst: UnusedBrokenConst,
|
|
|
|
// Uses attr::is_used which is untracked, can't be an incremental module pass.
|
|
|
|
UnusedAttributes: UnusedAttributes::new(),
|
|
|
|
// Needs to run after UnusedAttributes as it marks all `feature` attributes as used.
|
|
|
|
UnstableFeatures: UnstableFeatures,
|
|
|
|
// Tracks state across modules
|
|
|
|
UnnameableTestItems: UnnameableTestItems::new(),
|
|
|
|
// Tracks attributes of parents
|
|
|
|
MissingDoc: MissingDoc::new(),
|
|
|
|
// Depends on access levels
|
|
|
|
// FIXME: Turn the computation of types which implement Debug into a query
|
|
|
|
// and change this to a module lint pass
|
|
|
|
MissingDebugImplementations: MissingDebugImplementations::default(),
|
|
|
|
ArrayIntoIter: ArrayIntoIter,
|
|
|
|
]
|
|
|
|
);
|
|
|
|
};
|
2019-01-31 01:36:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! late_lint_mod_passes {
|
2019-12-22 17:42:04 -05:00
|
|
|
($macro:path, $args:tt) => {
|
|
|
|
$macro!(
|
|
|
|
$args,
|
|
|
|
[
|
|
|
|
HardwiredLints: HardwiredLints,
|
|
|
|
ImproperCTypes: ImproperCTypes,
|
|
|
|
VariantSizeDifferences: VariantSizeDifferences,
|
|
|
|
BoxPointers: BoxPointers,
|
|
|
|
PathStatements: PathStatements,
|
|
|
|
// Depends on referenced function signatures in expressions
|
|
|
|
UnusedResults: UnusedResults,
|
|
|
|
NonUpperCaseGlobals: NonUpperCaseGlobals,
|
|
|
|
NonShorthandFieldPatterns: NonShorthandFieldPatterns,
|
|
|
|
UnusedAllocation: UnusedAllocation,
|
|
|
|
// Depends on types used in type definitions
|
|
|
|
MissingCopyImplementations: MissingCopyImplementations,
|
|
|
|
// Depends on referenced function signatures in expressions
|
|
|
|
MutableTransmutes: MutableTransmutes,
|
|
|
|
TypeAliasBounds: TypeAliasBounds,
|
|
|
|
TrivialConstraints: TrivialConstraints,
|
|
|
|
TypeLimits: TypeLimits::new(),
|
|
|
|
NonSnakeCase: NonSnakeCase,
|
|
|
|
InvalidNoMangleItems: InvalidNoMangleItems,
|
|
|
|
// Depends on access levels
|
|
|
|
UnreachablePub: UnreachablePub,
|
|
|
|
ExplicitOutlivesRequirements: ExplicitOutlivesRequirements,
|
|
|
|
InvalidValue: InvalidValue,
|
|
|
|
]
|
|
|
|
);
|
|
|
|
};
|
2019-01-31 01:36:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! declare_combined_late_pass {
|
|
|
|
([$v:vis $name:ident], $passes:tt) => (
|
|
|
|
late_lint_methods!(declare_combined_late_lint_pass, [$v $name, $passes], ['tcx]);
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Make a separate lint type which do not require typeck tables
|
|
|
|
late_lint_passes!(declare_combined_late_pass, [pub BuiltinCombinedLateLintPass]);
|
|
|
|
|
|
|
|
late_lint_mod_passes!(declare_combined_late_pass, [BuiltinCombinedModuleLateLintPass]);
|
|
|
|
|
2019-10-09 09:53:13 -04:00
|
|
|
pub fn new_lint_store(no_interleave_lints: bool, internal_lints: bool) -> lint::LintStore {
|
|
|
|
let mut lint_store = lint::LintStore::new();
|
|
|
|
|
|
|
|
register_builtins(&mut lint_store, no_interleave_lints);
|
|
|
|
if internal_lints {
|
|
|
|
register_internals(&mut lint_store);
|
|
|
|
}
|
|
|
|
|
|
|
|
lint_store
|
|
|
|
}
|
|
|
|
|
2015-02-25 23:03:44 +11:00
|
|
|
/// Tell the `LintStore` about all the built-in lints (the ones
|
|
|
|
/// defined in this crate and the ones defined in
|
|
|
|
/// `rustc::lint::builtin`).
|
2019-10-09 09:53:13 -04:00
|
|
|
fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool) {
|
2019-01-18 07:40:55 +01:00
|
|
|
macro_rules! add_lint_group {
|
2019-09-23 20:26:11 -04:00
|
|
|
($name:expr, $($lint:ident),*) => (
|
|
|
|
store.register_group(false, $name, None, vec![$(LintId::of($lint)),*]);
|
2018-09-15 15:26:45 +01:00
|
|
|
)
|
2018-07-14 16:40:17 +02:00
|
|
|
}
|
|
|
|
|
2019-01-31 01:36:11 +01:00
|
|
|
macro_rules! register_pass {
|
2019-12-22 17:42:04 -05:00
|
|
|
($method:ident, $ty:ident, $constructor:expr) => {
|
2019-10-07 18:04:05 -04:00
|
|
|
store.register_lints(&$ty::get_lints());
|
2019-10-07 18:10:41 -04:00
|
|
|
store.$method(|| box $constructor);
|
2019-12-22 17:42:04 -05:00
|
|
|
};
|
2019-01-31 01:36:11 +01:00
|
|
|
}
|
|
|
|
|
2019-01-18 07:40:55 +01:00
|
|
|
macro_rules! register_passes {
|
2019-10-07 17:21:50 -04:00
|
|
|
($method:ident, [$($passes:ident: $constructor:expr,)*]) => (
|
2019-01-18 07:40:55 +01:00
|
|
|
$(
|
2019-10-07 18:04:05 -04:00
|
|
|
register_pass!($method, $passes, $constructor);
|
2019-01-18 07:40:55 +01:00
|
|
|
)*
|
2018-09-15 15:26:45 +01:00
|
|
|
)
|
2016-10-18 18:04:28 +13:00
|
|
|
}
|
|
|
|
|
2019-09-23 20:26:11 -04:00
|
|
|
if no_interleave_lints {
|
2019-10-07 17:21:50 -04:00
|
|
|
pre_expansion_lint_passes!(register_passes, register_pre_expansion_pass);
|
|
|
|
early_lint_passes!(register_passes, register_early_pass);
|
|
|
|
late_lint_passes!(register_passes, register_late_pass);
|
|
|
|
late_lint_mod_passes!(register_passes, register_late_mod_pass);
|
2019-01-18 07:40:55 +01:00
|
|
|
} else {
|
2019-10-07 18:04:05 -04:00
|
|
|
store.register_lints(&BuiltinCombinedPreExpansionLintPass::get_lints());
|
|
|
|
store.register_lints(&BuiltinCombinedEarlyLintPass::get_lints());
|
|
|
|
store.register_lints(&BuiltinCombinedModuleLateLintPass::get_lints());
|
|
|
|
store.register_lints(&BuiltinCombinedLateLintPass::get_lints());
|
2015-02-25 22:44:44 +11:00
|
|
|
}
|
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
add_lint_group!(
|
|
|
|
"nonstandard_style",
|
|
|
|
NON_CAMEL_CASE_TYPES,
|
|
|
|
NON_SNAKE_CASE,
|
|
|
|
NON_UPPER_CASE_GLOBALS
|
|
|
|
);
|
|
|
|
|
|
|
|
add_lint_group!(
|
|
|
|
"unused",
|
|
|
|
UNUSED_IMPORTS,
|
|
|
|
UNUSED_VARIABLES,
|
|
|
|
UNUSED_ASSIGNMENTS,
|
|
|
|
DEAD_CODE,
|
|
|
|
UNUSED_MUT,
|
|
|
|
UNREACHABLE_CODE,
|
|
|
|
UNREACHABLE_PATTERNS,
|
|
|
|
OVERLAPPING_PATTERNS,
|
|
|
|
UNUSED_MUST_USE,
|
|
|
|
UNUSED_UNSAFE,
|
|
|
|
PATH_STATEMENTS,
|
|
|
|
UNUSED_ATTRIBUTES,
|
|
|
|
UNUSED_MACROS,
|
|
|
|
UNUSED_ALLOCATION,
|
|
|
|
UNUSED_DOC_COMMENTS,
|
|
|
|
UNUSED_EXTERN_CRATES,
|
|
|
|
UNUSED_FEATURES,
|
|
|
|
UNUSED_LABELS,
|
|
|
|
UNUSED_PARENS
|
|
|
|
);
|
|
|
|
|
|
|
|
add_lint_group!(
|
|
|
|
"rust_2018_idioms",
|
|
|
|
BARE_TRAIT_OBJECTS,
|
|
|
|
UNUSED_EXTERN_CRATES,
|
|
|
|
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
|
|
|
|
ELIDED_LIFETIMES_IN_PATHS,
|
|
|
|
EXPLICIT_OUTLIVES_REQUIREMENTS // FIXME(#52665, #47816) not always applicable and not all
|
|
|
|
// macros are ready for this yet.
|
|
|
|
// UNREACHABLE_PUB,
|
|
|
|
|
|
|
|
// FIXME macro crates are not up for this yet, too much
|
|
|
|
// breakage is seen if we try to encourage this lint.
|
|
|
|
// MACRO_USE_EXTERN_CRATE
|
|
|
|
);
|
|
|
|
|
|
|
|
add_lint_group!(
|
|
|
|
"rustdoc",
|
|
|
|
INTRA_DOC_LINK_RESOLUTION_FAILURE,
|
|
|
|
MISSING_DOC_CODE_EXAMPLES,
|
|
|
|
PRIVATE_DOC_TESTS
|
|
|
|
);
|
2018-12-10 14:58:57 -06:00
|
|
|
|
2018-11-27 02:59:49 +00:00
|
|
|
// Register renamed and removed lints.
|
2018-05-19 01:13:53 +03:00
|
|
|
store.register_renamed("single_use_lifetime", "single_use_lifetimes");
|
|
|
|
store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths");
|
|
|
|
store.register_renamed("bare_trait_object", "bare_trait_objects");
|
|
|
|
store.register_renamed("unstable_name_collision", "unstable_name_collisions");
|
|
|
|
store.register_renamed("unused_doc_comment", "unused_doc_comments");
|
2018-08-24 13:48:20 -07:00
|
|
|
store.register_renamed("async_idents", "keyword_idents");
|
2018-07-23 21:05:39 +01:00
|
|
|
store.register_removed("unknown_features", "replaced by an error");
|
2017-10-21 00:00:57 +03:00
|
|
|
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
|
2016-01-11 12:31:46 +01:00
|
|
|
store.register_removed("negate_unsigned", "cast a signed value instead");
|
2016-01-13 18:54:06 +00:00
|
|
|
store.register_removed("raw_pointer_derive", "using derive with raw pointers is ok");
|
2018-11-27 02:59:49 +00:00
|
|
|
// Register lint group aliases.
|
2018-09-15 15:26:45 +01:00
|
|
|
store.register_group_alias("nonstandard_style", "bad_style");
|
2018-11-27 02:59:49 +00:00
|
|
|
// This was renamed to `raw_pointer_derive`, which was then removed,
|
|
|
|
// so it is also considered removed.
|
2017-10-21 00:00:57 +03:00
|
|
|
store.register_removed("raw_pointer_deriving", "using derive with raw pointers is ok");
|
2016-08-23 10:39:30 +03:00
|
|
|
store.register_removed("drop_with_repr_extern", "drop flags have been removed");
|
2017-10-21 00:00:57 +03:00
|
|
|
store.register_removed("fat_ptr_transmutes", "was accidentally removed back in 2014");
|
|
|
|
store.register_removed("deprecated_attr", "use `deprecated` instead");
|
2019-12-22 17:42:04 -05:00
|
|
|
store.register_removed(
|
|
|
|
"transmute_from_fn_item_types",
|
|
|
|
"always cast functions before transmuting them",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"hr_lifetime_in_assoc_type",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/33685",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"inaccessible_extern_crate",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/36886",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"super_or_self_in_global_path",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/36888",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"overlapping_inherent_impls",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/36889",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"illegal_floating_point_constant_pattern",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/36890",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"illegal_struct_or_enum_constant_pattern",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/36891",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"lifetime_underscore",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/36892",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"extra_requirement_in_impl",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/37166",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"legacy_imports",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/38260",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"coerce_never",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/48950",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"resolve_trait_on_defaulted_unit",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/48950",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"private_no_mangle_fns",
|
|
|
|
"no longer a warning, `#[no_mangle]` functions always exported",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"private_no_mangle_statics",
|
|
|
|
"no longer a warning, `#[no_mangle]` statics always exported",
|
|
|
|
);
|
|
|
|
store.register_removed("bad_repr", "replaced with a generic attribute input check");
|
|
|
|
store.register_removed(
|
|
|
|
"duplicate_matcher_binding_name",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/57742",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"incoherent_fundamental_impls",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/46205",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"legacy_constructor_visibility",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/39207",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"legacy_directory_ownership",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/37872",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"safe_extern_statics",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/36247",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"parenthesized_params_in_types_and_modules",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/42238",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"duplicate_macro_exports",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/35896",
|
|
|
|
);
|
|
|
|
store.register_removed(
|
|
|
|
"nested_impl_trait",
|
|
|
|
"converted into hard error, see https://github.com/rust-lang/rust/issues/59014",
|
|
|
|
);
|
2019-11-30 14:08:39 +03:00
|
|
|
store.register_removed("plugin_as_library", "plugins have been deprecated and retired");
|
2015-02-25 22:44:44 +11:00
|
|
|
}
|
2018-12-06 14:03:12 +01:00
|
|
|
|
2019-10-09 09:53:13 -04:00
|
|
|
fn register_internals(store: &mut lint::LintStore) {
|
2019-10-07 18:04:05 -04:00
|
|
|
store.register_lints(&DefaultHashTypes::get_lints());
|
2019-10-07 18:10:41 -04:00
|
|
|
store.register_early_pass(|| box DefaultHashTypes::new());
|
2019-10-07 18:04:05 -04:00
|
|
|
store.register_lints(&LintPassImpl::get_lints());
|
2019-10-07 18:10:41 -04:00
|
|
|
store.register_early_pass(|| box LintPassImpl);
|
2019-10-07 18:04:05 -04:00
|
|
|
store.register_lints(&TyTyKind::get_lints());
|
2019-10-07 18:10:41 -04:00
|
|
|
store.register_late_pass(|| box TyTyKind);
|
2018-12-06 14:03:12 +01:00
|
|
|
store.register_group(
|
|
|
|
false,
|
2019-06-17 17:06:11 +02:00
|
|
|
"rustc::internal",
|
2018-12-06 14:03:12 +01:00
|
|
|
None,
|
|
|
|
vec![
|
|
|
|
LintId::of(DEFAULT_HASH_TYPES),
|
|
|
|
LintId::of(USAGE_OF_TY_TYKIND),
|
2019-05-02 16:53:12 +02:00
|
|
|
LintId::of(LINT_PASS_IMPL_WITHOUT_MACRO),
|
2019-04-24 23:22:54 +02:00
|
|
|
LintId::of(TY_PASS_BY_REFERENCE),
|
|
|
|
LintId::of(USAGE_OF_QUALIFIED_TY),
|
2018-12-06 14:03:12 +01:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|