Add hardwired lint for dyn trait

This commit is contained in:
Manish Goregaokar 2018-02-22 22:14:08 -08:00
parent da9dc0507b
commit 3eeabe7b7d
2 changed files with 15 additions and 2 deletions

View File

@ -15,6 +15,7 @@
//! lints are all available in `rustc_lint::builtin`.
use lint::{LintPass, LateLintPass, LintArray};
use session::config::Epoch;
declare_lint! {
pub CONST_ERR,
@ -252,6 +253,13 @@ declare_lint! {
"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
/// which are used by other parts of the compiler.
#[derive(Copy, Clone)]
@ -298,8 +306,8 @@ impl LintPass for HardwiredLints {
COERCE_NEVER,
SINGLE_USE_LIFETIME,
TYVAR_BEHIND_RAW_POINTER,
ELIDED_LIFETIME_IN_PATH
ELIDED_LIFETIME_IN_PATH,
BARE_TRAIT_OBJECT
)
}
}

View File

@ -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>",
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