Skip to content

Commit 5f15458

Browse files
rgiotillicitonion
authored andcommitted
Fix ambiguous_associated_items case (#4)
Hello, my enum looks like that: ```rust #[derive(IntoPrimitive, TryFromPrimitive, Copy, Clone, PartialEq, Debug)] #[repr(u8)] pub enum BasicTokenNoPrefix { EndOfTokenisedLine = 0, StatementSeparator = 1, [...] Error, [...] } ``` and I obtain this compilation error when using it: ``` error: ambiguous associated item --> src/basic/tokens.rs:7:10 | 7 | #[derive(IntoPrimitive, TryFromPrimitive, Copy, Clone, PartialEq, Debug)] | ^^^^^^^^^^^^^^^^ | = note: #[deny(ambiguous_associated_items)] on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #57644 <rust-lang/rust#57644> note: `Error` could refer to variant defined here --> src/basic/tokens.rs:145:5 | 14| Error, | ^^^^^ note: `Error` could also refer to associated type defined here ``` This patch allows to fix this issue.
1 parent 86f8937 commit 5f15458

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn derive_try_from_primitive(stream: TokenStream) -> TokenStream {
5555
impl ::std::convert::TryFrom<#repr> for #name {
5656
type Error=String;
5757

58-
fn try_from(number: #repr) -> Result<Self, Self::Error> {
58+
fn try_from(number: #repr) -> Result<Self, String> {
5959
#( const #match_const_names: #repeated_repr = #match_const_exprs; )*
6060

6161
match number {

0 commit comments

Comments
 (0)