diff --git a/src/libstd/error.rs b/src/libstd/error.rs index aeb822fa99e66..c8978a94fcda4 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -94,7 +94,7 @@ pub trait Error: Debug + Display { /// "I'm the superhero of errors" /// } /// - /// fn cause(&self) -> Option<&Error> { + /// fn cause(&self) -> Option<&dyn Error> { /// Some(&self.side) /// } /// } @@ -244,7 +244,7 @@ impl<'a, E: Error + 'a> From for Box { /// /// let an_error = AnError; /// assert!(0 == mem::size_of_val(&an_error)); - /// let a_boxed_error = Box::::from(an_error); + /// let a_boxed_error = Box::::from(an_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` fn from(err: E) -> Box { @@ -287,7 +287,7 @@ impl<'a, E: Error + Send + Sync + 'a> From for Box::from(an_error); + /// let a_boxed_error = Box::::from(an_error); /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` @@ -309,7 +309,7 @@ impl From for Box { /// use std::mem; /// /// let a_string_error = "a string error".to_string(); - /// let a_boxed_error = Box::::from(a_string_error); + /// let a_boxed_error = Box::::from(a_string_error); /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` @@ -344,7 +344,7 @@ impl From for Box { /// use std::mem; /// /// let a_string_error = "a string error".to_string(); - /// let a_boxed_error = Box::::from(a_string_error); + /// let a_boxed_error = Box::::from(a_string_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` fn from(str_err: String) -> Box { @@ -367,7 +367,7 @@ impl<'a> From<&str> for Box { /// use std::mem; /// /// let a_str_error = "a str error"; - /// let a_boxed_error = Box::::from(a_str_error); + /// let a_boxed_error = Box::::from(a_str_error); /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` @@ -389,7 +389,7 @@ impl From<&str> for Box { /// use std::mem; /// /// let a_str_error = "a str error"; - /// let a_boxed_error = Box::::from(a_str_error); + /// let a_boxed_error = Box::::from(a_str_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` fn from(err: &str) -> Box { @@ -412,7 +412,7 @@ impl<'a, 'b> From> for Box { /// use std::borrow::Cow; /// /// let a_cow_str_error = Cow::from("a str error"); - /// let a_boxed_error = Box::::from(a_cow_str_error); + /// let a_boxed_error = Box::::from(a_cow_str_error); /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` @@ -436,7 +436,7 @@ impl<'a> From> for Box { /// use std::borrow::Cow; /// /// let a_cow_str_error = Cow::from("a str error"); - /// let a_boxed_error = Box::::from(a_cow_str_error); + /// let a_boxed_error = Box::::from(a_cow_str_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` fn from(err: Cow<'a, str>) -> Box { diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 616b5eb836ffd..d41b3a3a1233f 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1976,7 +1976,7 @@ pub fn remove_dir_all>(path: P) -> io::Result<()> { /// use std::path::Path; /// /// // one possible implementation of walking a directory only visiting files -/// fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> { +/// fn visit_dirs(dir: &Path, cb: &dyn Fn(&DirEntry)) -> io::Result<()> { /// if dir.is_dir() { /// for entry in fs::read_dir(dir)? { /// let entry = entry?;