Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous associated item error when deriving TryFrom, TryInto or FromStr #409

Closed
bluurryy opened this issue Sep 5, 2024 · 0 comments · Fixed by #410
Closed

Ambiguous associated item error when deriving TryFrom, TryInto or FromStr #409

bluurryy opened this issue Sep 5, 2024 · 0 comments · Fixed by #410
Assignees
Labels
Milestone

Comments

@bluurryy
Copy link
Contributor

bluurryy commented Sep 5, 2024

Deriving TryFrom, TryInto or FromStr when there's an associated item called Error or Err will fail.

All of these derives fail:

use derive_more::*;

#[derive(TryFrom)]
#[try_from(repr)]
#[repr(u8)]
enum LogLevel {
    Error,
}

#[derive(FromStr)]
enum EnumNoFields {
    Err,
}

#[derive(TryInto)]
enum MixedInts {
    Foo(LogLevel),
}

I will send a PR shortly that will fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants