Open
Description
use std::convert::From;
struct SomeError;
enum Error<E> {
One(SomeError),
Two(E),
}
/// impl<E> From<SomeError> for Error<E> where E: !SomeError {
impl<E> From<E> for Error<E> {
fn from(error: E) -> Self {
Error::One(error)
}
}
impl<E> From<SomeError> for Error<E> {
fn from(error: E) -> Self {
Error::Two(error)
}
}
It's produces error:
rustc 1.18.0 (03fc9d622 2017-06-06)
error: main function not found
error[E0119]: conflicting implementations of trait `std::convert::From<SomeError>` for type `Error<SomeError>`:
--> <anon>:15:1
|
9 | / impl<E> From<E> for Error<E> {
10 | | fn from(error: E) -> Self {
11 | | Error::One(error)
12 | | }
13 | | }
| |_- first implementation hereadd
14 |
15 | / impl<E> From<SomeError> for Error<E> {
16 | | fn from(error: E) -> Self {
17 | | Error::Two(error)
18 | | }
19 | | }
| |_^ conflicting implementation for `Error<SomeError>`
error: aborting due to previous error
May'be shall implement contruction:
impl<E> From<SomeError> for Error<E> where E: !SomeError {
...
}