Add hardwired lint for dyn trait
This commit is contained in:
parent
da9dc0507b
commit
3eeabe7b7d
2 changed files with 15 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
||||||
//! lints are all available in `rustc_lint::builtin`.
|
//! lints are all available in `rustc_lint::builtin`.
|
||||||
|
|
||||||
use lint::{LintPass, LateLintPass, LintArray};
|
use lint::{LintPass, LateLintPass, LintArray};
|
||||||
|
use session::config::Epoch;
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
pub CONST_ERR,
|
pub CONST_ERR,
|
||||||
|
@ -252,6 +253,13 @@ declare_lint! {
|
||||||
"hidden lifetime parameters are deprecated, try `Foo<'_>`"
|
"hidden lifetime parameters are deprecated, try `Foo<'_>`"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare_lint! {
|
||||||
|
pub BARE_TRAIT_OBJECT,
|
||||||
|
Warn,
|
||||||
|
"suggest using `dyn Trait` for trait objects",
|
||||||
|
Epoch::Epoch2018
|
||||||
|
}
|
||||||
|
|
||||||
/// Does nothing as a lint pass, but registers some `Lint`s
|
/// Does nothing as a lint pass, but registers some `Lint`s
|
||||||
/// which are used by other parts of the compiler.
|
/// which are used by other parts of the compiler.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
|
@ -298,8 +306,8 @@ impl LintPass for HardwiredLints {
|
||||||
COERCE_NEVER,
|
COERCE_NEVER,
|
||||||
SINGLE_USE_LIFETIME,
|
SINGLE_USE_LIFETIME,
|
||||||
TYVAR_BEHIND_RAW_POINTER,
|
TYVAR_BEHIND_RAW_POINTER,
|
||||||
ELIDED_LIFETIME_IN_PATH
|
ELIDED_LIFETIME_IN_PATH,
|
||||||
|
BARE_TRAIT_OBJECT
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,6 +272,11 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
|
||||||
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
||||||
epoch: None,
|
epoch: None,
|
||||||
},
|
},
|
||||||
|
FutureIncompatibleInfo {
|
||||||
|
id: LintId::of(lint::builtin::BARE_TRAIT_OBJECT),
|
||||||
|
reference: "issue #48457 <https://github.com/rust-lang/rust/issues/48457>",
|
||||||
|
epoch: Some(session::config::Epoch::Epoch2018),
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Register renamed and removed lints
|
// Register renamed and removed lints
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue