Closed bluurryy closed 1 month ago
Resolves #409
Fixes the "abiguous associated item" error when deriving TryFrom, TryInto or FromStr when those types have an associated item called Error or Err respectively.
TryFrom
TryInto
FromStr
Error
Err
All these derives produce that error:
use derive_more::*; #[derive(TryFrom)] #[try_from(repr)] #[repr(u8)] enum LogLevel { Error, } #[derive(FromStr)] enum EnumNoFields { Err, } #[derive(TryInto)] enum MixedInts { Foo(LogLevel), }
In the derive macro I replaced Self::Error with the type that's behind it. I could also replace it with <Self as #trait_path>::Error if you'd prefer.
Self::Error
<Self as #trait_path>::Error
I added some regression tests. (I checked that those tests fail on the master branch.)
The CI failures are unrelated, they are from compile_fail failures due to some new compiler error help message.
Resolves #409
Synopsis
Fixes the "abiguous associated item" error when deriving
TryFrom
,TryInto
orFromStr
when those types have an associated item calledError
orErr
respectively.All these derives produce that error:
Solution
In the derive macro I replaced
Self::Error
with the type that's behind it. I could also replace it with<Self as #trait_path>::Error
if you'd prefer.Checklist