Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit fe5db6e

Browse files
committed
Merge branch 'foreign-link'
With std::io::Error, we get `conflicting implementaitions of trait std::convert::From<std::io::Error> for type Error`.
2 parents 7488924 + f42a1f9 commit fe5db6e

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/lib.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,16 @@ macro_rules! error_chain {
432432
}
433433
}
434434

435-
impl<S: Into<String>> From<S> for $error_name {
436-
fn from(s: S) -> Self {
437-
$error_name(s.into().into(),
435+
impl<'a> From<&'a str> for $error_name {
436+
fn from(s: &'a str) -> Self {
437+
$error_name(s.into(),
438+
(None, $crate::make_backtrace()))
439+
}
440+
}
441+
442+
impl From<String> for $error_name {
443+
fn from(s: String) -> Self {
444+
$error_name(s.into(),
438445
(None, $crate::make_backtrace()))
439446
}
440447
}
@@ -490,9 +497,15 @@ macro_rules! error_chain {
490497
}
491498
) *
492499

493-
impl<S: Into<String>> From<S> for $error_kind_name {
494-
fn from(s: S) -> Self {
495-
$error_kind_name::Msg(s.into())
500+
impl<'a> From<&'a str> for $error_kind_name {
501+
fn from(s: &'a str) -> Self {
502+
$error_kind_name::Msg(s.to_string())
503+
}
504+
}
505+
506+
impl From<String> for $error_kind_name {
507+
fn from(s: String) -> Self {
508+
$error_kind_name::Msg(s)
496509
}
497510
}
498511

0 commit comments

Comments
 (0)