diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-11-25 17:05:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-25 17:05:03 +0100 |
| commit | 6398df1520638c68bb75daa33d64c75387c26b1f (patch) | |
| tree | 1408ff0aafcbd3ef385353f2ee61048b6dd242d2 /src/liballoc | |
| parent | 45e5a856a6551ae1b77fe8c5585e80f886b44b6e (diff) | |
| parent | ebb1a48b415c1b586bb652d58f3d2078d87f44dd (diff) | |
| download | rust-6398df1520638c68bb75daa33d64c75387c26b1f.tar.gz rust-6398df1520638c68bb75daa33d64c75387c26b1f.zip | |
Rollup merge of #56101 - frewsxcv:frewsxcv-dyn, r=steveklabnik
Incorporate `dyn` into more comments and docs. r? @rust-lang/docs
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 16 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 4 |
2 files changed, 10 insertions, 10 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 diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 705345ce963..3ca6de191de 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -633,7 +633,7 @@ impl<T: Clone> Rc<T> { impl Rc<dyn Any> { #[inline] #[stable(feature = "rc_downcast", since = "1.29.0")] - /// Attempt to downcast the `Rc<Any>` to a concrete type. + /// Attempt to downcast the `Rc<dyn Any>` to a concrete type. /// /// # Examples /// @@ -641,7 +641,7 @@ impl Rc<dyn Any> { /// use std::any::Any; /// use std::rc::Rc; /// - /// fn print_if_string(value: Rc<Any>) { + /// fn print_if_string(value: Rc<dyn Any>) { /// if let Ok(string) = value.downcast::<String>() { /// println!("String ({}): {}", string.len(), string); /// } |
