about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2018-07-11 12:38:49 -0600
committerGitHub <noreply@github.com>2018-07-11 12:38:49 -0600
commita0b288e1b85424bb3a5b1f89fc904d431d904a1c (patch)
treeecccdd7baa7a2aea62eb9fc8f40ffb877ce71903
parent7585bd5b394e6acb107da49fc5aa3365e2cc067c (diff)
parent715b8852e4a94875683c41771e45043d579065ce (diff)
downloadrust-a0b288e1b85424bb3a5b1f89fc904d431d904a1c.tar.gz
rust-a0b288e1b85424bb3a5b1f89fc904d431d904a1c.zip
Rollup merge of #52265 - ljedrz:dyn_librustc_codegen_utils, r=oli-obk
Deny bare trait objects in in src/librustc_codegen_utils

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_codegen_utils`.
-rw-r--r--src/librustc_codegen_utils/codegen_backend.rs24
-rw-r--r--src/librustc_codegen_utils/lib.rs1
2 files changed, 13 insertions, 12 deletions
diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs
index 57e6c0d7b85..3f230dd5d45 100644
--- a/src/librustc_codegen_utils/codegen_backend.rs
+++ b/src/librustc_codegen_utils/codegen_backend.rs
@@ -56,23 +56,23 @@ pub trait CodegenBackend {
     fn print_version(&self) {}
     fn diagnostics(&self) -> &[(&'static str, &'static str)] { &[] }
 
-    fn metadata_loader(&self) -> Box<MetadataLoader + Sync>;
+    fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync>;
     fn provide(&self, _providers: &mut Providers);
     fn provide_extern(&self, _providers: &mut Providers);
     fn codegen_crate<'a, 'tcx>(
         &self,
         tcx: TyCtxt<'a, 'tcx, 'tcx>,
-        rx: mpsc::Receiver<Box<Any + Send>>
-    ) -> Box<Any>;
+        rx: mpsc::Receiver<Box<dyn Any + Send>>
+    ) -> Box<dyn Any>;
 
-    /// This is called on the returned `Box<Any>` from `codegen_backend`
+    /// This is called on the returned `Box<dyn Any>` from `codegen_backend`
     ///
     /// # Panics
     ///
-    /// Panics when the passed `Box<Any>` was not returned by `codegen_backend`.
+    /// Panics when the passed `Box<dyn Any>` was not returned by `codegen_backend`.
     fn join_codegen_and_link(
         &self,
-        ongoing_codegen: Box<Any>,
+        ongoing_codegen: Box<dyn Any>,
         sess: &Session,
         dep_graph: &DepGraph,
         outputs: &OutputFilenames,
@@ -105,7 +105,7 @@ pub struct OngoingCodegen {
 }
 
 impl MetadataOnlyCodegenBackend {
-    pub fn new() -> Box<CodegenBackend> {
+    pub fn new() -> Box<dyn CodegenBackend> {
         box MetadataOnlyCodegenBackend(())
     }
 }
@@ -125,7 +125,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
         }
     }
 
-    fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
+    fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
         box NoLlvmMetadataLoader
     }
 
@@ -145,8 +145,8 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
     fn codegen_crate<'a, 'tcx>(
         &self,
         tcx: TyCtxt<'a, 'tcx, 'tcx>,
-        _rx: mpsc::Receiver<Box<Any + Send>>
-    ) -> Box<Any> {
+        _rx: mpsc::Receiver<Box<dyn Any + Send>>
+    ) -> Box<dyn Any> {
         use rustc_mir::monomorphize::item::MonoItem;
 
         ::check_for_rustc_errors_attr(tcx);
@@ -193,13 +193,13 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
 
     fn join_codegen_and_link(
         &self,
-        ongoing_codegen: Box<Any>,
+        ongoing_codegen: Box<dyn Any>,
         sess: &Session,
         _dep_graph: &DepGraph,
         outputs: &OutputFilenames,
     ) -> Result<(), CompileIncomplete> {
         let ongoing_codegen = ongoing_codegen.downcast::<OngoingCodegen>()
-            .expect("Expected MetadataOnlyCodegenBackend's OngoingCodegen, found Box<Any>");
+            .expect("Expected MetadataOnlyCodegenBackend's OngoingCodegen, found Box<dyn Any>");
         for &crate_type in sess.opts.crate_types.iter() {
             if crate_type != CrateType::CrateTypeRlib && crate_type != CrateType::CrateTypeDylib {
                 continue;
diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs
index f59cf5832fc..e9031007a4e 100644
--- a/src/librustc_codegen_utils/lib.rs
+++ b/src/librustc_codegen_utils/lib.rs
@@ -20,6 +20,7 @@
 #![feature(box_syntax)]
 #![feature(custom_attribute)]
 #![allow(unused_attributes)]
+#![deny(bare_trait_objects)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]