about summary refs log tree commit diff
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-07-11 12:05:10 +0200
committerljedrz <ljedrz@gmail.com>2018-07-11 12:05:10 +0200
commit48e501f3788845d8befc5d80f6bc5df55c7fe211 (patch)
tree584c5bf13d2f530d42c94eadca64d4c6fe72bd39
parent77117e383676176116851d7d3ec04b5e0cf0c456 (diff)
downloadrust-48e501f3788845d8befc5d80f6bc5df55c7fe211.tar.gz
rust-48e501f3788845d8befc5d80f6bc5df55c7fe211.zip
Deny bare trait objects in in src/librustc
-rw-r--r--src/librustc/hir/lowering.rs8
-rw-r--r--src/librustc/lib.rs2
-rw-r--r--src/librustc/middle/cstore.rs2
3 files changed, 7 insertions, 5 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 56df9533607..7dd7954c8f4 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -82,9 +82,9 @@ pub struct LoweringContext<'a> {
     // Use to assign ids to hir nodes that do not directly correspond to an ast node
     sess: &'a Session,
 
-    cstore: &'a CrateStore,
+    cstore: &'a dyn CrateStore,
 
-    resolver: &'a mut Resolver,
+    resolver: &'a mut dyn Resolver,
 
     /// The items being lowered are collected here.
     items: BTreeMap<NodeId, hir::Item>,
@@ -199,10 +199,10 @@ impl<'a> ImplTraitContext<'a> {
 
 pub fn lower_crate(
     sess: &Session,
-    cstore: &CrateStore,
+    cstore: &dyn CrateStore,
     dep_graph: &DepGraph,
     krate: &Crate,
-    resolver: &mut Resolver,
+    resolver: &mut dyn Resolver,
 ) -> hir::Crate {
     // We're constructing the HIR here; we don't care what we will
     // read, since we haven't even constructed the *input* to
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 8050522d066..c72952efc61 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -36,6 +36,8 @@
 //!
 //! This API is completely unstable and subject to change.
 
+#![deny(bare_trait_objects)]
+
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
        html_root_url = "https://doc.rust-lang.org/nightly/")]
diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs
index 518021f4125..ed8e1654d5a 100644
--- a/src/librustc/middle/cstore.rs
+++ b/src/librustc/middle/cstore.rs
@@ -257,7 +257,7 @@ pub trait CrateStore {
     fn metadata_encoding_version(&self) -> &[u8];
 }
 
-pub type CrateStoreDyn = CrateStore + sync::Sync;
+pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
 
 // FIXME: find a better place for this?
 pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {