From 8a01b780d129e05f5d8d49067632136da12a32cf Mon Sep 17 00:00:00 2001 From: James Whaley Date: Mon, 18 Mar 2024 13:50:36 +0000 Subject: [PATCH] Fix issue with ambiguous associated items --- src/expand.rs | 2 +- tests/issues.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/issues.rs diff --git a/src/expand.rs b/src/expand.rs index 582c4e8..074ba00 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -64,7 +64,7 @@ fn derive_enum(input: EnumInput) -> Result { type Error = #repr; #[inline] - fn try_from(v: #repr) -> ::core::result::Result { + fn try_from(v: #repr) -> ::core::result::Result { match v { #(#try_from_int_args)* v => ::core::result::Result::Err(v), diff --git a/tests/issues.rs b/tests/issues.rs new file mode 100644 index 0000000..59aaf1a --- /dev/null +++ b/tests/issues.rs @@ -0,0 +1,10 @@ +use int_enum::IntEnum; + +#[test] +fn issue17() { + #[derive(Debug, PartialEq, IntEnum)] + #[repr(u8)] + enum Issue17 { + Error = 0, + } +}