1
Fork 0

Use lifetime contravariance to elide more lifetimes in core+alloc+std

This commit is contained in:
Scott McMurray 2019-03-09 19:10:28 -08:00
parent 26b4cb4848
commit df4ea90b39
19 changed files with 93 additions and 93 deletions

View file

@ -337,7 +337,7 @@ impl From<String> for Box<dyn Error> {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b> From<&'b str> for Box<dyn Error + Send + Sync + 'a> {
impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
/// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
///
/// # Examples
@ -351,13 +351,13 @@ impl<'a, 'b> From<&'b str> for Box<dyn Error + Send + Sync + 'a> {
/// assert!(
/// mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))
/// ```
fn from(err: &'b str) -> Box<dyn Error + Send + Sync + 'a> {
fn from(err: &str) -> Box<dyn Error + Send + Sync + 'a> {
From::from(String::from(err))
}
}
#[stable(feature = "string_box_error", since = "1.6.0")]
impl<'a> From<&'a str> for Box<dyn Error> {
impl From<&str> for Box<dyn Error> {
/// Converts a [`str`] into a box of dyn [`Error`].
///
/// # Examples
@ -370,7 +370,7 @@ impl<'a> From<&'a str> for Box<dyn Error> {
/// let a_boxed_error = Box::<Error>::from(a_str_error);
/// assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))
/// ```
fn from(err: &'a str) -> Box<dyn Error> {
fn from(err: &str) -> Box<dyn Error> {
From::from(String::from(err))
}
}