@@ -489,7 +489,7 @@ impl Box<dyn Any> {
489
489
/// ```
490
490
/// use std::any::Any;
491
491
///
492
- /// fn print_if_string(value: Box<Any>) {
492
+ /// fn print_if_string(value: Box<dyn Any>) {
493
493
/// if let Ok(string) = value.downcast::<String>() {
494
494
/// println!("String ({}): {}", string.len(), string);
495
495
/// }
@@ -523,7 +523,7 @@ impl Box<dyn Any + Send> {
523
523
/// ```
524
524
/// use std::any::Any;
525
525
///
526
- /// fn print_if_string(value: Box<Any + Send>) {
526
+ /// fn print_if_string(value: Box<dyn Any + Send>) {
527
527
/// if let Ok(string) = value.downcast::<String>() {
528
528
/// println!("String ({}): {}", string.len(), string);
529
529
/// }
@@ -618,18 +618,18 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
618
618
619
619
/// `FnBox` is a version of the `FnOnce` intended for use with boxed
620
620
/// closure objects. The idea is that where one would normally store a
621
- /// `Box<FnOnce()>` in a data structure, you should use
622
- /// `Box<FnBox()>`. The two traits behave essentially the same, except
621
+ /// `Box<dyn FnOnce()>` in a data structure, you should use
622
+ /// `Box<dyn FnBox()>`. The two traits behave essentially the same, except
623
623
/// that a `FnBox` closure can only be called if it is boxed. (Note
624
- /// that `FnBox` may be deprecated in the future if `Box<FnOnce()>`
624
+ /// that `FnBox` may be deprecated in the future if `Box<dyn FnOnce()>`
625
625
/// closures become directly usable.)
626
626
///
627
627
/// # Examples
628
628
///
629
629
/// Here is a snippet of code which creates a hashmap full of boxed
630
630
/// once closures and then removes them one by one, calling each
631
631
/// closure as it is removed. Note that the type of the closures
632
- /// stored in the map is `Box<FnBox() -> i32>` and not `Box<FnOnce()
632
+ /// stored in the map is `Box<dyn FnBox() -> i32>` and not `Box<dyn FnOnce()
633
633
/// -> i32>`.
634
634
///
635
635
/// ```
@@ -638,8 +638,8 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
638
638
/// use std::boxed::FnBox;
639
639
/// use std::collections::HashMap;
640
640
///
641
- /// fn make_map() -> HashMap<i32, Box<FnBox() -> i32>> {
642
- /// let mut map: HashMap<i32, Box<FnBox() -> i32>> = HashMap::new();
641
+ /// fn make_map() -> HashMap<i32, Box<dyn FnBox() -> i32>> {
642
+ /// let mut map: HashMap<i32, Box<dyn FnBox() -> i32>> = HashMap::new();
643
643
/// map.insert(1, Box::new(|| 22));
644
644
/// map.insert(2, Box::new(|| 44));
645
645
/// map
0 commit comments