]> git.lizzy.rs Git - rust.git/commitdiff
Deny bare trait objects in src/librustc_errors
authorljedrz <ljedrz@gmail.com>
Thu, 12 Jul 2018 07:33:33 +0000 (09:33 +0200)
committerljedrz <ljedrz@gmail.com>
Sat, 14 Jul 2018 05:23:32 +0000 (07:23 +0200)
Enforce `#![deny(bare_trait_objects)]` in `src/librustc_errors`.

src/librustc_errors/diagnostic.rs
src/librustc_errors/diagnostic_builder.rs
src/librustc_errors/emitter.rs
src/librustc_errors/lib.rs
src/librustc_errors/lock.rs

index de73295b499fa3866e1c463a723235c8ba2c6fc9..d079102a4ba0003e4b362217075c0816b00a6180 100644 (file)
@@ -121,7 +121,7 @@ pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self
     }
 
     pub fn note_expected_found(&mut self,
-                               label: &fmt::Display,
+                               label: &dyn fmt::Display,
                                expected: DiagnosticStyledString,
                                found: DiagnosticStyledString)
                                -> &mut Self
@@ -130,11 +130,11 @@ pub fn note_expected_found(&mut self,
     }
 
     pub fn note_expected_found_extra(&mut self,
-                                     label: &fmt::Display,
+                                     label: &dyn fmt::Display,
                                      expected: DiagnosticStyledString,
                                      found: DiagnosticStyledString,
-                                     expected_extra: &fmt::Display,
-                                     found_extra: &fmt::Display)
+                                     expected_extra: &dyn fmt::Display,
+                                     found_extra: &dyn fmt::Display)
                                      -> &mut Self
     {
         let mut msg: Vec<_> = vec![(format!("expected {} `", label), Style::NoStyle)];
index 562c28f08405a50a8873f87c84f2ccc01287127a..9c7b7ea3395402dc715ba030e55d3706fb1064ac 100644 (file)
@@ -148,17 +148,17 @@ pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self
     }
 
     forward!(pub fn note_expected_found(&mut self,
-                                        label: &fmt::Display,
+                                        label: &dyn fmt::Display,
                                         expected: DiagnosticStyledString,
                                         found: DiagnosticStyledString)
                                         -> &mut Self);
 
     forward!(pub fn note_expected_found_extra(&mut self,
-                                              label: &fmt::Display,
+                                              label: &dyn fmt::Display,
                                               expected: DiagnosticStyledString,
                                               found: DiagnosticStyledString,
-                                              expected_extra: &fmt::Display,
-                                              found_extra: &fmt::Display)
+                                              expected_extra: &dyn fmt::Display,
+                                              found_extra: &dyn fmt::Display)
                                               -> &mut Self);
 
     forward!(pub fn note(&mut self, msg: &str) -> &mut Self);
index e79a3a87738ec407903ecb1690f515d797659442..2f71c3a7232de9238df1d7455488a17825322bc4 100644 (file)
@@ -148,7 +148,7 @@ pub fn stderr(color_config: ColorConfig,
         }
     }
 
-    pub fn new(dst: Box<Write + Send>,
+    pub fn new(dst: Box<dyn Write + Send>,
                code_map: Option<Lrc<CodeMapperDyn>>,
                short_message: bool,
                teach: bool)
@@ -1469,13 +1469,13 @@ fn emit_to_destination(rendered_buffer: &Vec<Vec<StyledString>>,
 pub enum Destination {
     Terminal(StandardStream),
     Buffered(BufferWriter),
-    Raw(Box<Write + Send>),
+    Raw(Box<dyn Write + Send>),
 }
 
 pub enum WritableDst<'a> {
     Terminal(&'a mut StandardStream),
     Buffered(&'a mut BufferWriter, Buffer),
-    Raw(&'a mut Box<Write + Send>),
+    Raw(&'a mut Box<dyn Write + Send>),
 }
 
 impl Destination {
index fd90e1cbe0866b16bdbfaefb2dfd20c4e6055a20..f18a7bd9136a209b9e994055a6ee76c20eca405b 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![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/")]
@@ -110,7 +112,7 @@ pub struct SubstitutionPart {
     pub snippet: String,
 }
 
-pub type CodeMapperDyn = CodeMapper + sync::Send + sync::Sync;
+pub type CodeMapperDyn = dyn CodeMapper + sync::Send + sync::Sync;
 
 pub trait CodeMapper {
     fn lookup_char_pos(&self, pos: BytePos) -> Loc;
@@ -270,7 +272,7 @@ pub struct Handler {
     pub flags: HandlerFlags,
 
     err_count: AtomicUsize,
-    emitter: Lock<Box<Emitter + sync::Send>>,
+    emitter: Lock<Box<dyn Emitter + sync::Send>>,
     continue_after_error: LockCell<bool>,
     delayed_span_bug: Lock<Option<Diagnostic>>,
 
@@ -326,7 +328,7 @@ pub fn with_tty_emitter_and_flags(color_config: ColorConfig,
 
     pub fn with_emitter(can_emit_warnings: bool,
                         treat_err_as_bug: bool,
-                        e: Box<Emitter + sync::Send>)
+                        e: Box<dyn Emitter + sync::Send>)
                         -> Handler {
         Handler::with_emitter_and_flags(
             e,
@@ -337,7 +339,8 @@ pub fn with_emitter(can_emit_warnings: bool,
             })
     }
 
-    pub fn with_emitter_and_flags(e: Box<Emitter + sync::Send>, flags: HandlerFlags) -> Handler {
+    pub fn with_emitter_and_flags(e: Box<dyn Emitter + sync::Send>, flags: HandlerFlags) -> Handler
+    {
         Handler {
             flags,
             err_count: AtomicUsize::new(0),
index 4c298228c37c7f4b2fa9abf52cbccdf6380d4f93..dff8d53986db598a204fba5e6c32b355e8bc71cb 100644 (file)
@@ -23,7 +23,7 @@
 
 #[cfg(windows)]
 #[allow(bad_style)]
-pub fn acquire_global_lock(name: &str) -> Box<Any> {
+pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
     use std::ffi::CString;
     use std::io;
 
@@ -110,6 +110,6 @@ fn drop(&mut self) {
 }
 
 #[cfg(unix)]
-pub fn acquire_global_lock(_name: &str) -> Box<Any> {
+pub fn acquire_global_lock(_name: &str) -> Box<dyn Any> {
     Box::new(())
 }