about summary refs log tree commit diff
path: root/src/liballoc/boxed.rs
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2018-11-20 09:34:15 -0500
committerCorey Farwell <coreyf@rwell.org>2018-11-20 09:35:03 -0500
commit033cbfec4d3bb23948a99379f8d63b7cfe5eed45 (patch)
treedafb092e141350a043f38234e513ff1de69cbee0 /src/liballoc/boxed.rs
parent7a0cef74a8b859184b46d7ae6f7e01367fab5fb0 (diff)
downloadrust-033cbfec4d3bb23948a99379f8d63b7cfe5eed45.tar.gz
rust-033cbfec4d3bb23948a99379f8d63b7cfe5eed45.zip
Incorporate `dyn` into more comments and docs.
Diffstat (limited to 'src/liballoc/boxed.rs')
-rw-r--r--src/liballoc/boxed.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 63b262d1f3d..c3a84bf778d 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -489,7 +489,7 @@ impl Box<dyn Any> {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn print_if_string(value: Box<Any>) {
+    /// fn print_if_string(value: Box<dyn Any>) {
     ///     if let Ok(string) = value.downcast::<String>() {
     ///         println!("String ({}): {}", string.len(), string);
     ///     }
@@ -523,7 +523,7 @@ impl Box<dyn Any + Send> {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn print_if_string(value: Box<Any + Send>) {
+    /// fn print_if_string(value: Box<dyn Any + Send>) {
     ///     if let Ok(string) = value.downcast::<String>() {
     ///         println!("String ({}): {}", string.len(), string);
     ///     }
@@ -618,10 +618,10 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
 
 /// `FnBox` is a version of the `FnOnce` intended for use with boxed
 /// closure objects. The idea is that where one would normally store a
-/// `Box<FnOnce()>` in a data structure, you should use
-/// `Box<FnBox()>`. The two traits behave essentially the same, except
+/// `Box<dyn FnOnce()>` in a data structure, you should use
+/// `Box<dyn FnBox()>`. The two traits behave essentially the same, except
 /// that a `FnBox` closure can only be called if it is boxed. (Note
-/// that `FnBox` may be deprecated in the future if `Box<FnOnce()>`
+/// that `FnBox` may be deprecated in the future if `Box<dyn FnOnce()>`
 /// closures become directly usable.)
 ///
 /// # Examples
@@ -629,7 +629,7 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
 /// Here is a snippet of code which creates a hashmap full of boxed
 /// once closures and then removes them one by one, calling each
 /// closure as it is removed. Note that the type of the closures
-/// stored in the map is `Box<FnBox() -> i32>` and not `Box<FnOnce()
+/// stored in the map is `Box<dyn FnBox() -> i32>` and not `Box<dyn FnOnce()
 /// -> i32>`.
 ///
 /// ```
@@ -638,8 +638,8 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
 /// use std::boxed::FnBox;
 /// use std::collections::HashMap;
 ///
-/// fn make_map() -> HashMap<i32, Box<FnBox() -> i32>> {
-///     let mut map: HashMap<i32, Box<FnBox() -> i32>> = HashMap::new();
+/// fn make_map() -> HashMap<i32, Box<dyn FnBox() -> i32>> {
+///     let mut map: HashMap<i32, Box<dyn FnBox() -> i32>> = HashMap::new();
 ///     map.insert(1, Box::new(|| 22));
 ///     map.insert(2, Box::new(|| 44));
 ///     map