From 48e501f3788845d8befc5d80f6bc5df55c7fe211 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Wed, 11 Jul 2018 12:05:10 +0200 Subject: [PATCH] Deny bare trait objects in in src/librustc --- src/librustc/hir/lowering.rs | 8 ++++---- src/librustc/lib.rs | 2 ++ src/librustc/middle/cstore.rs | 2 +- 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, @@ -199,10 +199,10 @@ fn reborrow(&'b mut self) -> ImplTraitContext<'b> { 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 @@ fn encode_metadata<'a, 'tcx>(&self, 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) { -- 2.44.0