-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-specializationArea: Trait impl specializationArea: Trait impl specializationA-trait-systemArea: Trait systemArea: Trait systemC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team
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 {
...
}
SimonSapin, stepancheg, edrevo, Avi-D-coder, shenek and 87 more
Metadata
Metadata
Assignees
Labels
A-specializationArea: Trait impl specializationArea: Trait impl specializationA-trait-systemArea: Trait systemArea: Trait systemC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team