diff options
| author | bors <bors@rust-lang.org> | 2018-07-11 19:50:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-11 19:50:14 +0000 |
| commit | 704af2d7e1474ba60a0b70a5aa78e29905abb4e1 (patch) | |
| tree | ecccdd7baa7a2aea62eb9fc8f40ffb877ce71903 /src/liballoc/sync.rs | |
| parent | d573fe17786b9c2f5a766498d411d54eee5fa19f (diff) | |
| parent | a0b288e1b85424bb3a5b1f89fc904d431d904a1c (diff) | |
| download | rust-704af2d7e1474ba60a0b70a5aa78e29905abb4e1.tar.gz rust-704af2d7e1474ba60a0b70a5aa78e29905abb4e1.zip | |
Auto merge of #52268 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 14 pull requests Successful merges: - #51614 (Correct suggestion for println) - #51952 ( hygiene: Decouple transparencies from expansion IDs) - #52193 (step_by: leave time of item skip unspecified) - #52207 (improve error message shown for unsafe operations) - #52223 (Deny bare trait objects in in src/liballoc) - #52224 (Deny bare trait objects in in src/libsyntax) - #52239 (Remove sync::Once::call_once 'static bound) - #52247 (Deny bare trait objects in in src/librustc) - #52248 (Deny bare trait objects in in src/librustc_allocator) - #52252 (Deny bare trait objects in in src/librustc_codegen_llvm) - #52253 (Deny bare trait objects in in src/librustc_data_structures) - #52254 (Deny bare trait objects in in src/librustc_metadata) - #52261 (Deny bare trait objects in in src/libpanic_unwind) - #52265 (Deny bare trait objects in in src/librustc_codegen_utils) Failed merges: r? @ghost
Diffstat (limited to 'src/liballoc/sync.rs')
| -rw-r--r-- | src/liballoc/sync.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 5a738fc5444..5def0237e7e 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -978,10 +978,10 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc<T> { } } -impl Arc<Any + Send + Sync> { +impl Arc<dyn Any + Send + Sync> { #[inline] #[stable(feature = "rc_downcast", since = "1.29.0")] - /// Attempt to downcast the `Arc<Any + Send + Sync>` to a concrete type. + /// Attempt to downcast the `Arc<dyn Any + Send + Sync>` to a concrete type. /// /// # Examples /// @@ -989,7 +989,7 @@ impl Arc<Any + Send + Sync> { /// use std::any::Any; /// use std::sync::Arc; /// - /// fn print_if_string(value: Arc<Any + Send + Sync>) { + /// fn print_if_string(value: Arc<dyn Any + Send + Sync>) { /// if let Ok(string) = value.downcast::<String>() { /// println!("String ({}): {}", string.len(), string); /// } @@ -1574,7 +1574,7 @@ mod tests { assert_eq!(unsafe { &*ptr }, "foo"); assert_eq!(arc, arc2); - let arc: Arc<Display> = Arc::new(123); + let arc: Arc<dyn Display> = Arc::new(123); let ptr = Arc::into_raw(arc.clone()); let arc2 = unsafe { Arc::from_raw(ptr) }; @@ -1879,8 +1879,8 @@ mod tests { use std::fmt::Display; use std::string::ToString; - let b: Box<Display> = box 123; - let r: Arc<Display> = Arc::from(b); + let b: Box<dyn Display> = box 123; + let r: Arc<dyn Display> = Arc::from(b); assert_eq!(r.to_string(), "123"); } @@ -1889,8 +1889,8 @@ mod tests { fn test_from_box_trait_zero_sized() { use std::fmt::Debug; - let b: Box<Debug> = box (); - let r: Arc<Debug> = Arc::from(b); + let b: Box<dyn Debug> = box (); + let r: Arc<dyn Debug> = Arc::from(b); assert_eq!(format!("{:?}", r), "()"); } @@ -1907,8 +1907,8 @@ mod tests { fn test_downcast() { use std::any::Any; - let r1: Arc<Any + Send + Sync> = Arc::new(i32::max_value()); - let r2: Arc<Any + Send + Sync> = Arc::new("abc"); + let r1: Arc<dyn Any + Send + Sync> = Arc::new(i32::max_value()); + let r2: Arc<dyn Any + Send + Sync> = Arc::new("abc"); assert!(r1.clone().downcast::<u32>().is_err()); |
