about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-02-22 22:14:08 -0800
committerManish Goregaokar <manishsmail@gmail.com>2018-02-23 08:24:07 -0800
commit3eeabe7b7d13f8ca2d29e117f45cd420d6f73da4 (patch)
tree93eec18d9f91860175b81cb2fa0edee18819264f /src
parentda9dc0507bc86104db8bf7a99e849bfd995fb1ef (diff)
downloadrust-3eeabe7b7d13f8ca2d29e117f45cd420d6f73da4.tar.gz
rust-3eeabe7b7d13f8ca2d29e117f45cd420d6f73da4.zip
Add hardwired lint for dyn trait
Diffstat (limited to 'src')
-rw-r--r--src/librustc/lint/builtin.rs12
-rw-r--r--src/librustc_lint/lib.rs5
2 files changed, 15 insertions, 2 deletions
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 0577800f3f4..2b1ff8a0e78 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -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
         )
     }
 }
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index c35a3fbe419..c162b8409af 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -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