Skip to content

Commit

Permalink
inline impl From<String> for Box<dyn Error + Send + Sync>
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jan 10, 2020
1 parent 76e698f commit 5f3f1a3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libstd/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ impl From<String> for Box<dyn Error + Send + Sync> {
/// assert!(
/// mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))
/// ```
#[inline]
fn from(err: String) -> Box<dyn Error + Send + Sync> {
struct StringError(String);

Expand Down Expand Up @@ -317,6 +318,7 @@ impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
/// assert!(
/// mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))
/// ```
#[inline]
fn from(err: &str) -> Box<dyn Error + Send + Sync + 'a> {
From::from(String::from(err))
}
Expand Down

0 comments on commit 5f3f1a3

Please sign in to comment.