You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An idea for improving explicitness (I may submit a PR in the future)
At the moment:
#[derive(From)]enumConflicting{A(u8),B(u8),C(u16)}#[test]fnconflicting_enum(){let a = Conflicting::from(4u8);}
produces:
error[E0119]: conflicting implementations of trait `std::convert::From<u8>` for type `Conflicting`
--> tests/from.rs:56:10
|
56 | #[derive(From)]
| ^^^^
| |
| first implementation here
| conflicting implementation for `Conflicting`
|
where it would be better to produce:
error: Conflicting types found when attempting to derive `From` for `Conflicting` (`Conflicting::A(u8)`, `Conflicting::B(u8)`). Please ignore all/all-but-one of the variants.
--> tests/from.rs:65:5
|
65 | std::compile_error!("Conflicting types found when attempting to derive `From` for `Conflicting` (`Conflicting::A(u8)`, Please ignore all/all-but-one of the variants.`Conflicting::B(u8)`).");
|
The text was updated successfully, but these errors were encountered:
I agree that this error is not very helpful and that we should improve it. It should be fairly simple. The code we use to derive From could simply track if it is going to generate implementations for identical types (using a HashSet for instance) and if so, fail with a useful error.
An idea for improving explicitness (I may submit a PR in the future)
At the moment:
produces:
where it would be better to produce:
The text was updated successfully, but these errors were encountered: